forked from qt-creator/qt-creator
ProjectExplorer: fix gcc toolchain detection on windows
Change-Id: Ibf23eeca79389562bc38a01ca9ec7799e22787fe Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -1235,8 +1235,8 @@ static FilePaths findCompilerCandidates(const ToolchainDetector &detector,
|
|||||||
<< ("*-*-*-*-" + compilerName
|
<< ("*-*-*-*-" + compilerName
|
||||||
+ "-[1-9]*"); // "x86_64-pc-linux-gnu-gcc-7.4.1"
|
+ "-[1-9]*"); // "x86_64-pc-linux-gnu-gcc-7.4.1"
|
||||||
}
|
}
|
||||||
nameFilters = transform(nameFilters,
|
const Utils::OsType os = device ? device->osType() : HostOsInfo::hostOs();
|
||||||
[os = device ? device->osType() : HostOsInfo::hostOs()](const QString &baseName) {
|
nameFilters = transform(nameFilters, [os](const QString &baseName) {
|
||||||
return OsSpecificAspects::withExecutableSuffix(os, baseName);
|
return OsSpecificAspects::withExecutableSuffix(os, baseName);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1269,9 +1269,11 @@ static FilePaths findCompilerCandidates(const ToolchainDetector &detector,
|
|||||||
|
|
||||||
for (const FilePath &searchPath : std::as_const(searchPaths)) {
|
for (const FilePath &searchPath : std::as_const(searchPaths)) {
|
||||||
static const QRegularExpression regexp(binaryRegexp);
|
static const QRegularExpression regexp(binaryRegexp);
|
||||||
const auto callBack = [&compilerPaths, compilerName](const FilePath &candidate) {
|
const auto callBack = [os, &compilerPaths, compilerName](const FilePath &candidate) {
|
||||||
if (candidate.fileName() == compilerName || regexp.match(candidate.path()).hasMatch())
|
if (candidate.fileName() == OsSpecificAspects::withExecutableSuffix(os, compilerName)
|
||||||
|
|| regexp.match(candidate.path()).hasMatch()) {
|
||||||
compilerPaths << candidate;
|
compilerPaths << candidate;
|
||||||
|
}
|
||||||
return IterationPolicy::Continue;
|
return IterationPolicy::Continue;
|
||||||
};
|
};
|
||||||
searchPath.iterateDirectory(callBack, {nameFilters, QDir::Files | QDir::Executable});
|
searchPath.iterateDirectory(callBack, {nameFilters, QDir::Files | QDir::Executable});
|
||||||
|
|||||||
Reference in New Issue
Block a user