diff options
author | Marcus Tillmanns <marcus.tillmanns@qt.io> | 2022-12-02 13:37:21 +0100 |
---|---|---|
committer | Marcus Tillmanns <marcus.tillmanns@qt.io> | 2023-01-10 06:38:41 +0000 |
commit | a9c1beed7a442da051b2e457940dda97cc7886c5 (patch) | |
tree | e837d03d4ad70cceb7b2233a53e9f29816d7efe6 | |
parent | b6bd59fc5722dcf17cd803686423aae1de90eb96 (diff) | |
download | qt-creator-a9c1beed7a442da051b2e457940dda97cc7886c5.tar.gz |
iOS: Cache xcrun location
runSimCtlCommand() is called quite often when the
user is in the settings. Trying to start a command without
a full path makes QtcProcess search for the file in all PATH
directories every time.
Change-Id: I7eac4226a74c78269ae66ab8d2a2af3589a98e36
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
-rw-r--r-- | src/plugins/ios/simulatorcontrol.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/ios/simulatorcontrol.cpp b/src/plugins/ios/simulatorcontrol.cpp index 742cbf6075..4e19bf734c 100644 --- a/src/plugins/ios/simulatorcontrol.cpp +++ b/src/plugins/ios/simulatorcontrol.cpp @@ -72,7 +72,11 @@ static bool runCommand(const CommandLine &command, QString *stdOutput, QString * static bool runSimCtlCommand(QStringList args, QString *output, QString *allOutput = nullptr) { args.prepend("simctl"); - return runCommand({"xcrun", args}, output, allOutput); + + // Cache xcrun's path, as this function will be called often. + static FilePath xcrun = FilePath::fromString("xcrun").searchInPath(); + QTC_ASSERT(!xcrun.isEmpty() && xcrun.isExecutableFile(), xcrun.clear(); return false); + return runCommand({xcrun, args}, output, allOutput); } static bool launchSimulator(const QString &simUdid) { |