forked from qt-creator/qt-creator
Utils: allow specifying the requested extension for searchInPath
Reducing the expected executable extensions can improve the performance for search in path on Window. Especially if PATHEXT and PATH has a lot of entries, since we collect file attributes for PATHEXT entry count times PATH entry count file paths. Use this optimization in the android toolchain to search for java.exe on windows. Change-Id: I2c2865d685c2de0c03a0fa1fbe7e8afd283174da Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -94,7 +94,8 @@ void AndroidToolChain::addToEnvironment(Environment &env) const
|
||||
if (javaHome.exists()) {
|
||||
env.set(Constants::JAVA_HOME_ENV_VAR, javaHome.toUserOutput());
|
||||
const FilePath javaBin = javaHome.pathAppended("bin");
|
||||
const FilePath currentJavaFilePath = env.searchInPath("java");
|
||||
const FilePath currentJavaFilePath
|
||||
= env.searchInPath("java", {}, {}, FilePath::WithExeSuffix);
|
||||
if (!currentJavaFilePath.isChildOf(javaBin))
|
||||
env.prependOrSetPath(javaBin);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user