From bd4a501f15f32851697517d959d28c9ee681174f Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 11 Aug 2021 08:28:29 +0200 Subject: [PATCH] Replace some uses of HostOsInfo::withExecutableSuffix with FilePath Change-Id: Id72e9fd04dd4995ff2775ee919f747018cbcc339 Reviewed-by: Christian Stenger --- src/libs/extensionsystem/pluginmanager.cpp | 4 ++-- src/plugins/android/androiddeployqtstep.cpp | 2 +- src/plugins/android/androidrunnerworker.cpp | 4 ++-- src/plugins/autotest/testconfiguration.cpp | 2 +- src/plugins/mcusupport/mcusupportsdk.cpp | 4 +++- src/plugins/nim/project/nimbuildsystem.cpp | 2 +- src/plugins/nim/project/nimcompilerbuildstep.cpp | 2 +- src/plugins/python/pythonsettings.cpp | 5 ++--- src/plugins/qbsprojectmanager/qbsprojectimporter.cpp | 2 +- .../qmldesigner/designercore/instances/puppetcreator.cpp | 2 +- src/plugins/qnx/qnxconfiguration.cpp | 4 +--- src/plugins/qtsupport/baseqtversion.cpp | 6 +++--- 12 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index f2aac6b6730..46dff4d78a8 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -417,8 +417,8 @@ static QString filled(const QString &s, int min) QString PluginManager::systemInformation() { QString result; - CommandLine qtDiag(FilePath::fromString(HostOsInfo::withExecutableSuffix( - QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qtdiag"))); + CommandLine qtDiag(FilePath::fromString(QLibraryInfo::location(QLibraryInfo::BinariesPath)) + .pathAppended("qtdiag").withExecutableSuffix()); QtcProcess qtDiagProc; qtDiagProc.setCommand(qtDiag); qtDiagProc.runBlocking(); diff --git a/src/plugins/android/androiddeployqtstep.cpp b/src/plugins/android/androiddeployqtstep.cpp index 4adfeea8d4e..5ac1a2a210b 100644 --- a/src/plugins/android/androiddeployqtstep.cpp +++ b/src/plugins/android/androiddeployqtstep.cpp @@ -214,7 +214,7 @@ bool AndroidDeployQtStep::init() TaskHub::addTask(DeploymentTask(Task::Error, error)); return false; } - m_command = m_command.pathAppended(HostOsInfo::withExecutableSuffix("androiddeployqt")); + m_command = m_command.pathAppended("androiddeployqt").withExecutableSuffix(); m_workingDirectory = bc->buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY); diff --git a/src/plugins/android/androidrunnerworker.cpp b/src/plugins/android/androidrunnerworker.cpp index adfdf9ab93e..db282915111 100644 --- a/src/plugins/android/androidrunnerworker.cpp +++ b/src/plugins/android/androidrunnerworker.cpp @@ -745,8 +745,8 @@ void AndroidRunnerWorker::handleJdbWaiting() } m_afterFinishAdbCommands.push_back(removeForward.join(' ')); - auto jdbPath = AndroidConfigurations::currentConfig().openJDKLocation().pathAppended("bin"); - jdbPath = jdbPath.pathAppended(Utils::HostOsInfo::withExecutableSuffix("jdb")); + FilePath jdbPath = AndroidConfigurations::currentConfig().openJDKLocation() + .pathAppended("bin/jdb").withExecutableSuffix(); QStringList jdbArgs("-connect"); jdbArgs << QString("com.sun.jdi.SocketAttach:hostname=localhost,port=%1") diff --git a/src/plugins/autotest/testconfiguration.cpp b/src/plugins/autotest/testconfiguration.cpp index b5c49dabf34..cce0c322002 100644 --- a/src/plugins/autotest/testconfiguration.cpp +++ b/src/plugins/autotest/testconfiguration.cpp @@ -125,7 +125,7 @@ static FilePath ensureExeEnding(const FilePath &file) { if (!HostOsInfo::isWindowsHost() || file.isEmpty() || file.toString().toLower().endsWith(".exe")) return file; - return FilePath::fromString(HostOsInfo::withExecutableSuffix(file.toString())); + return file.withExecutableSuffix(); } void TestConfiguration::completeTestInformation(ProjectExplorer::RunConfiguration *rc, diff --git a/src/plugins/mcusupport/mcusupportsdk.cpp b/src/plugins/mcusupport/mcusupportsdk.cpp index 8cd34c0abf1..b805b4a91ae 100644 --- a/src/plugins/mcusupport/mcusupportsdk.cpp +++ b/src/plugins/mcusupport/mcusupportsdk.cpp @@ -43,6 +43,8 @@ #include #include +using namespace Utils; + namespace McuSupport { namespace Internal { namespace Sdk { @@ -65,7 +67,7 @@ McuPackage *createQtForMCUsPackage() auto result = new McuPackage( McuPackage::tr("Qt for MCUs SDK"), QDir::homePath(), - Utils::HostOsInfo::withExecutableSuffix("bin/qmltocpp"), + FilePath("bin/qmltocpp").withExecutableSuffix().toString(), Constants::SETTINGS_KEY_PACKAGE_QT_FOR_MCUS_SDK); result->setEnvironmentVariableName("Qul_DIR"); return result; diff --git a/src/plugins/nim/project/nimbuildsystem.cpp b/src/plugins/nim/project/nimbuildsystem.cpp index afb23f00561..95cfade2486 100644 --- a/src/plugins/nim/project/nimbuildsystem.cpp +++ b/src/plugins/nim/project/nimbuildsystem.cpp @@ -205,7 +205,7 @@ FilePath nimblePathFromKit(Kit *kit) // There's no extra setting for "nimble", derive it from the "nim" path. const QString nimbleFromPath = QStandardPaths::findExecutable("nimble"); const FilePath nimPath = nimPathFromKit(kit); - const FilePath nimbleFromKit = nimPath.pathAppended(HostOsInfo::withExecutableSuffix("nimble")); + const FilePath nimbleFromKit = nimPath.pathAppended("nimble").withExecutableSuffix(); return nimbleFromKit.exists() ? nimbleFromKit.canonicalPath() : FilePath::fromString(nimbleFromPath); } diff --git a/src/plugins/nim/project/nimcompilerbuildstep.cpp b/src/plugins/nim/project/nimcompilerbuildstep.cpp index f12e7cc326d..a81ebfb7410 100644 --- a/src/plugins/nim/project/nimcompilerbuildstep.cpp +++ b/src/plugins/nim/project/nimcompilerbuildstep.cpp @@ -213,7 +213,7 @@ CommandLine NimCompilerBuildStep::commandLine() FilePath NimCompilerBuildStep::outFilePath() const { const QString targetName = m_targetNimFile.baseName(); - return buildDirectory().pathAppended(HostOsInfo::withExecutableSuffix(targetName)); + return buildDirectory().pathAppended(targetName).withExecutableSuffix(); } void NimCompilerBuildStep::updateTargetNimFile() diff --git a/src/plugins/python/pythonsettings.cpp b/src/plugins/python/pythonsettings.cpp index b20a9f2f572..2f7ba4c7c94 100644 --- a/src/plugins/python/pythonsettings.cpp +++ b/src/plugins/python/pythonsettings.cpp @@ -391,11 +391,10 @@ static void addPythonsFromRegistry(QList &pythons) regVal = pythonRegistry.value("InstallPath/."); if (regVal.isValid()) { const FilePath &path = FilePath::fromUserInput(regVal.toString()); - const FilePath &python = path.pathAppended(HostOsInfo::withExecutableSuffix("python")); + const FilePath python = path.pathAppended("python").withExecutableSuffix(); if (python.exists() && !alreadyRegistered(pythons, python)) pythons << Interpreter(python, "Python " + versionGroup); - const FilePath &pythonw = path.pathAppended( - HostOsInfo::withExecutableSuffix("pythonw")); + const FilePath pythonw = path.pathAppended("pythonw").withExecutableSuffix(); if (pythonw.exists() && !alreadyRegistered(pythons, pythonw)) pythons << Interpreter(pythonw, "Python " + versionGroup, true); } diff --git a/src/plugins/qbsprojectmanager/qbsprojectimporter.cpp b/src/plugins/qbsprojectmanager/qbsprojectimporter.cpp index 5ac7ef47f38..eded9e977bb 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectimporter.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectimporter.cpp @@ -201,7 +201,7 @@ Kit *QbsProjectImporter::createKit(void *directoryData) const qCDebug(qbsPmLog) << "creating kit for imported build" << bgData->bgFilePath.toUserOutput(); QtVersionData qtVersionData; if (!bgData->qtBinPath.isEmpty()) { - const FilePath qmakeFilePath = bgData->qtBinPath.pathAppended(HostOsInfo::withExecutableSuffix("qmake")); + const FilePath qmakeFilePath = bgData->qtBinPath.pathAppended("qmake").withExecutableSuffix(); qtVersionData = findOrCreateQtVersion(qmakeFilePath); } return createTemporaryKit(qtVersionData,[this, bgData](Kit *k) -> void { diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp index bd174ba400b..c423323de66 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp +++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp @@ -374,7 +374,7 @@ static Utils::FilePath pathForBinPuppet(ProjectExplorer::Target *target) QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(target->kit()); if (currentQtVersion) - return currentQtVersion->binPath() / Utils::HostOsInfo::withExecutableSuffix("qml2puppet"); + return currentQtVersion->binPath().pathAppended("qml2puppet").withExecutableSuffix(); return {}; } diff --git a/src/plugins/qnx/qnxconfiguration.cpp b/src/plugins/qnx/qnxconfiguration.cpp index 4a55f7118fc..17f19f3d108 100644 --- a/src/plugins/qnx/qnxconfiguration.cpp +++ b/src/plugins/qnx/qnxconfiguration.cpp @@ -400,9 +400,7 @@ void QnxConfiguration::setDefaultConfiguration(const Utils::FilePath &envScript) m_qnxHost = FilePath::fromString(item.value).canonicalPath(); } - FilePath qccPath = FilePath::fromString(HostOsInfo::withExecutableSuffix( - m_qnxHost.toString() + QLatin1String("/usr/bin/qcc"))); - + const FilePath qccPath = m_qnxHost.pathAppended("usr/bin/qcc").withExecutableSuffix(); if (qccPath.exists()) m_qccCompiler = qccPath; diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 632b4bd89a3..d958c63c805 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -1044,9 +1044,9 @@ FilePath BaseQtVersion::qmlRuntimeFilePath() const FilePath path = binPath(); if (qtVersion() >= QtVersionNumber(6, 2, 0)) - path = path / HostOsInfo::withExecutableSuffix("qml"); + path = path.pathAppended("qml").withExecutableSuffix(); else - path = path / HostOsInfo::withExecutableSuffix("qmlscene"); + path = path.pathAppended("qmlscene").withExecutableSuffix(); d->m_qmlRuntimePath = path.isExecutableFile() ? path : FilePath(); @@ -1061,7 +1061,7 @@ FilePath BaseQtVersion::qmlplugindumpFilePath() const if (!d->m_qmlplugindumpPath.isEmpty()) return d->m_qmlplugindumpPath; - const FilePath path = binPath() / HostOsInfo::withExecutableSuffix("qmlplugindump"); + const FilePath path = binPath().pathAppended("qmlplugindump").withExecutableSuffix(); d->m_qmlplugindumpPath = path.isExecutableFile() ? path : FilePath(); return d->m_qmlplugindumpPath;