Replace some uses of HostOsInfo::withExecutableSuffix with FilePath

Change-Id: Id72e9fd04dd4995ff2775ee919f747018cbcc339
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-08-11 08:28:29 +02:00
parent d12861ea91
commit bd4a501f15
12 changed files with 19 additions and 20 deletions

View File

@@ -417,8 +417,8 @@ static QString filled(const QString &s, int min)
QString PluginManager::systemInformation() QString PluginManager::systemInformation()
{ {
QString result; QString result;
CommandLine qtDiag(FilePath::fromString(HostOsInfo::withExecutableSuffix( CommandLine qtDiag(FilePath::fromString(QLibraryInfo::location(QLibraryInfo::BinariesPath))
QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qtdiag"))); .pathAppended("qtdiag").withExecutableSuffix());
QtcProcess qtDiagProc; QtcProcess qtDiagProc;
qtDiagProc.setCommand(qtDiag); qtDiagProc.setCommand(qtDiag);
qtDiagProc.runBlocking(); qtDiagProc.runBlocking();

View File

@@ -214,7 +214,7 @@ bool AndroidDeployQtStep::init()
TaskHub::addTask(DeploymentTask(Task::Error, error)); TaskHub::addTask(DeploymentTask(Task::Error, error));
return false; 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); m_workingDirectory = bc->buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY);

View File

@@ -745,8 +745,8 @@ void AndroidRunnerWorker::handleJdbWaiting()
} }
m_afterFinishAdbCommands.push_back(removeForward.join(' ')); m_afterFinishAdbCommands.push_back(removeForward.join(' '));
auto jdbPath = AndroidConfigurations::currentConfig().openJDKLocation().pathAppended("bin"); FilePath jdbPath = AndroidConfigurations::currentConfig().openJDKLocation()
jdbPath = jdbPath.pathAppended(Utils::HostOsInfo::withExecutableSuffix("jdb")); .pathAppended("bin/jdb").withExecutableSuffix();
QStringList jdbArgs("-connect"); QStringList jdbArgs("-connect");
jdbArgs << QString("com.sun.jdi.SocketAttach:hostname=localhost,port=%1") jdbArgs << QString("com.sun.jdi.SocketAttach:hostname=localhost,port=%1")

View File

@@ -125,7 +125,7 @@ static FilePath ensureExeEnding(const FilePath &file)
{ {
if (!HostOsInfo::isWindowsHost() || file.isEmpty() || file.toString().toLower().endsWith(".exe")) if (!HostOsInfo::isWindowsHost() || file.isEmpty() || file.toString().toLower().endsWith(".exe"))
return file; return file;
return FilePath::fromString(HostOsInfo::withExecutableSuffix(file.toString())); return file.withExecutableSuffix();
} }
void TestConfiguration::completeTestInformation(ProjectExplorer::RunConfiguration *rc, void TestConfiguration::completeTestInformation(ProjectExplorer::RunConfiguration *rc,

View File

@@ -43,6 +43,8 @@
#include <QJsonObject> #include <QJsonObject>
#include <QVariant> #include <QVariant>
using namespace Utils;
namespace McuSupport { namespace McuSupport {
namespace Internal { namespace Internal {
namespace Sdk { namespace Sdk {
@@ -65,7 +67,7 @@ McuPackage *createQtForMCUsPackage()
auto result = new McuPackage( auto result = new McuPackage(
McuPackage::tr("Qt for MCUs SDK"), McuPackage::tr("Qt for MCUs SDK"),
QDir::homePath(), QDir::homePath(),
Utils::HostOsInfo::withExecutableSuffix("bin/qmltocpp"), FilePath("bin/qmltocpp").withExecutableSuffix().toString(),
Constants::SETTINGS_KEY_PACKAGE_QT_FOR_MCUS_SDK); Constants::SETTINGS_KEY_PACKAGE_QT_FOR_MCUS_SDK);
result->setEnvironmentVariableName("Qul_DIR"); result->setEnvironmentVariableName("Qul_DIR");
return result; return result;

View File

@@ -205,7 +205,7 @@ FilePath nimblePathFromKit(Kit *kit)
// There's no extra setting for "nimble", derive it from the "nim" path. // There's no extra setting for "nimble", derive it from the "nim" path.
const QString nimbleFromPath = QStandardPaths::findExecutable("nimble"); const QString nimbleFromPath = QStandardPaths::findExecutable("nimble");
const FilePath nimPath = nimPathFromKit(kit); 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); return nimbleFromKit.exists() ? nimbleFromKit.canonicalPath() : FilePath::fromString(nimbleFromPath);
} }

View File

@@ -213,7 +213,7 @@ CommandLine NimCompilerBuildStep::commandLine()
FilePath NimCompilerBuildStep::outFilePath() const FilePath NimCompilerBuildStep::outFilePath() const
{ {
const QString targetName = m_targetNimFile.baseName(); const QString targetName = m_targetNimFile.baseName();
return buildDirectory().pathAppended(HostOsInfo::withExecutableSuffix(targetName)); return buildDirectory().pathAppended(targetName).withExecutableSuffix();
} }
void NimCompilerBuildStep::updateTargetNimFile() void NimCompilerBuildStep::updateTargetNimFile()

View File

@@ -391,11 +391,10 @@ static void addPythonsFromRegistry(QList<Interpreter> &pythons)
regVal = pythonRegistry.value("InstallPath/."); regVal = pythonRegistry.value("InstallPath/.");
if (regVal.isValid()) { if (regVal.isValid()) {
const FilePath &path = FilePath::fromUserInput(regVal.toString()); 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)) if (python.exists() && !alreadyRegistered(pythons, python))
pythons << Interpreter(python, "Python " + versionGroup); pythons << Interpreter(python, "Python " + versionGroup);
const FilePath &pythonw = path.pathAppended( const FilePath pythonw = path.pathAppended("pythonw").withExecutableSuffix();
HostOsInfo::withExecutableSuffix("pythonw"));
if (pythonw.exists() && !alreadyRegistered(pythons, pythonw)) if (pythonw.exists() && !alreadyRegistered(pythons, pythonw))
pythons << Interpreter(pythonw, "Python " + versionGroup, true); pythons << Interpreter(pythonw, "Python " + versionGroup, true);
} }

View File

@@ -201,7 +201,7 @@ Kit *QbsProjectImporter::createKit(void *directoryData) const
qCDebug(qbsPmLog) << "creating kit for imported build" << bgData->bgFilePath.toUserOutput(); qCDebug(qbsPmLog) << "creating kit for imported build" << bgData->bgFilePath.toUserOutput();
QtVersionData qtVersionData; QtVersionData qtVersionData;
if (!bgData->qtBinPath.isEmpty()) { if (!bgData->qtBinPath.isEmpty()) {
const FilePath qmakeFilePath = bgData->qtBinPath.pathAppended(HostOsInfo::withExecutableSuffix("qmake")); const FilePath qmakeFilePath = bgData->qtBinPath.pathAppended("qmake").withExecutableSuffix();
qtVersionData = findOrCreateQtVersion(qmakeFilePath); qtVersionData = findOrCreateQtVersion(qmakeFilePath);
} }
return createTemporaryKit(qtVersionData,[this, bgData](Kit *k) -> void { return createTemporaryKit(qtVersionData,[this, bgData](Kit *k) -> void {

View File

@@ -374,7 +374,7 @@ static Utils::FilePath pathForBinPuppet(ProjectExplorer::Target *target)
QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(target->kit()); QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(target->kit());
if (currentQtVersion) if (currentQtVersion)
return currentQtVersion->binPath() / Utils::HostOsInfo::withExecutableSuffix("qml2puppet"); return currentQtVersion->binPath().pathAppended("qml2puppet").withExecutableSuffix();
return {}; return {};
} }

View File

@@ -400,9 +400,7 @@ void QnxConfiguration::setDefaultConfiguration(const Utils::FilePath &envScript)
m_qnxHost = FilePath::fromString(item.value).canonicalPath(); m_qnxHost = FilePath::fromString(item.value).canonicalPath();
} }
FilePath qccPath = FilePath::fromString(HostOsInfo::withExecutableSuffix( const FilePath qccPath = m_qnxHost.pathAppended("usr/bin/qcc").withExecutableSuffix();
m_qnxHost.toString() + QLatin1String("/usr/bin/qcc")));
if (qccPath.exists()) if (qccPath.exists())
m_qccCompiler = qccPath; m_qccCompiler = qccPath;

View File

@@ -1044,9 +1044,9 @@ FilePath BaseQtVersion::qmlRuntimeFilePath() const
FilePath path = binPath(); FilePath path = binPath();
if (qtVersion() >= QtVersionNumber(6, 2, 0)) if (qtVersion() >= QtVersionNumber(6, 2, 0))
path = path / HostOsInfo::withExecutableSuffix("qml"); path = path.pathAppended("qml").withExecutableSuffix();
else else
path = path / HostOsInfo::withExecutableSuffix("qmlscene"); path = path.pathAppended("qmlscene").withExecutableSuffix();
d->m_qmlRuntimePath = path.isExecutableFile() ? path : FilePath(); d->m_qmlRuntimePath = path.isExecutableFile() ? path : FilePath();
@@ -1061,7 +1061,7 @@ FilePath BaseQtVersion::qmlplugindumpFilePath() const
if (!d->m_qmlplugindumpPath.isEmpty()) if (!d->m_qmlplugindumpPath.isEmpty())
return d->m_qmlplugindumpPath; 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(); d->m_qmlplugindumpPath = path.isExecutableFile() ? path : FilePath();
return d->m_qmlplugindumpPath; return d->m_qmlplugindumpPath;