From fa071d03cc2b944560fa7070489d84c7042f4195 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 14 Feb 2022 16:41:57 +0100 Subject: [PATCH] ProjectExplorer: Fix accumulating .exe suffixes ... when trying to detect GCC on Windows. Also make the code device-correct. Fixes: QTCREATORBUG-27057 Change-Id: Iaaa25c152a1cf0e0f05cd6d6db629b7a72b25166 Reviewed-by: hjk --- src/plugins/projectexplorer/gcctoolchain.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index a194f3f8f3c..155a2e2eec4 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -1110,6 +1110,10 @@ static FilePaths findCompilerCandidates(const IDevice::ConstPtr &device, << ("*-*-*-*-" + compilerName + "-[1-9]*"); // "x86_64-pc-linux-gnu-gcc-7.4.1" } + nameFilters = transform(nameFilters, + [os = device ? device->osType() : HostOsInfo::hostOs()](const QString &baseName) { + return OsSpecificAspects::withExecutableSuffix(os, baseName); + }); FilePaths compilerPaths; @@ -1145,9 +1149,6 @@ static FilePaths findCompilerCandidates(const IDevice::ConstPtr &device, for (const FilePath &dir : qAsConst(searchPaths)) { static const QRegularExpression regexp(binaryRegexp); QDir binDir(dir.toString()); - nameFilters = transform(nameFilters, [](const QString &baseName) { - return HostOsInfo::withExecutableSuffix(baseName); - }); const QStringList fileNames = binDir.entryList(nameFilters, QDir::Files | QDir::Executable); for (const QString &fileName : fileNames) {