CMakeProjectManager: Avoid direct QFileInfo use in cmaketoolsettingsaccessor

Change-Id: I0fe6fc9b84cb810f43d7f0d737afa5fa299ac724
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
hjk
2022-09-27 10:29:06 +02:00
parent e4b1c1754c
commit c22fcef5ce

View File

@@ -14,13 +14,10 @@
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <QDebug> #include <QDebug>
#include <QDir>
#include <QFileInfo>
using namespace Utils; using namespace Utils;
namespace CMakeProjectManager { namespace CMakeProjectManager::Internal {
namespace Internal {
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// CMakeToolSettingsUpgraders: // CMakeToolSettingsUpgraders:
@@ -75,11 +72,10 @@ static std::vector<std::unique_ptr<CMakeTool>> autoDetectCMakeTools()
if (base.isEmpty()) if (base.isEmpty())
continue; continue;
QFileInfo fi;
for (const QString &exec : execs) { for (const QString &exec : execs) {
fi.setFile(QDir(base.toString()), exec); const FilePath suspect = base.resolvePath(exec);
if (fi.exists() && fi.isFile() && fi.isExecutable()) if (suspect.isExecutableFile())
suspects << FilePath::fromString(fi.absoluteFilePath()); suspects << suspect;
} }
} }
@@ -238,5 +234,4 @@ CMakeToolSettingsAccessor::cmakeTools(const QVariantMap &data, bool fromSdk) con
return result; return result;
} }
} // namespace Internal } // CMakeProjectManager::Internal
} // namespace CMakeProjectManager