diff --git a/src/libs/utils/commandline.cpp b/src/libs/utils/commandline.cpp index cf451a8cbd5..e7672658c36 100644 --- a/src/libs/utils/commandline.cpp +++ b/src/libs/utils/commandline.cpp @@ -1598,6 +1598,17 @@ QStringList CommandLine::splitArguments() const return ProcessArgs::splitArgs(m_arguments, m_executable.osType()); } +CommandLine CommandLine::toLocal() const +{ + if (m_executable.isLocal()) + return *this; + + QTC_CHECK(false); // TODO: Does it make sense? + CommandLine cmd = *this; + cmd.setExecutable(FilePath::fromString(m_executable.path())); + return cmd; +} + QTCREATOR_UTILS_EXPORT bool operator==(const CommandLine &first, const CommandLine &second) { return first.m_executable == second.m_executable && first.m_arguments == second.m_arguments; diff --git a/src/libs/utils/commandline.h b/src/libs/utils/commandline.h index 78f756a9f61..cc01ec7eb2f 100644 --- a/src/libs/utils/commandline.h +++ b/src/libs/utils/commandline.h @@ -184,6 +184,7 @@ public: QStringList splitArguments() const; bool isEmpty() const { return m_executable.isEmpty(); } + CommandLine toLocal() const; private: friend QTCREATOR_UTILS_EXPORT bool operator==(const CommandLine &first, const CommandLine &second); diff --git a/src/plugins/baremetal/debugservers/gdb/gdbserverprovider.cpp b/src/plugins/baremetal/debugservers/gdb/gdbserverprovider.cpp index ea8d4312597..dfa494707ff 100644 --- a/src/plugins/baremetal/debugservers/gdb/gdbserverprovider.cpp +++ b/src/plugins/baremetal/debugservers/gdb/gdbserverprovider.cpp @@ -176,8 +176,7 @@ RunWorker *GdbServerProvider::targetRunner(RunControl *runControl) const worker->setId("BareMetalGdbServer"); // Baremetal's GDB servers are launched on the host, not on the target. worker->setStartModifier([worker, cmd = command()] { - worker->setCommandLine(cmd); - worker->forceRunOnHost(); + worker->setCommandLine(cmd.toLocal()); }); return worker; } diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp index 52819edb0a3..f7288bc9b09 100644 --- a/src/plugins/projectexplorer/runcontrol.cpp +++ b/src/plugins/projectexplorer/runcontrol.cpp @@ -1710,15 +1710,6 @@ void ProcessRunner::suppressDefaultStdOutHandling() d->m_suppressDefaultStdOutHandling = true; } -void ProcessRunner::forceRunOnHost() -{ - const FilePath executable = d->m_command.executable(); - if (!executable.isLocal()) { - QTC_CHECK(false); - d->m_command.setExecutable(FilePath::fromString(executable.path())); - } -} - // RunWorkerPrivate RunWorkerPrivate::RunWorkerPrivate(RunWorker *runWorker, RunControl *runControl) diff --git a/src/plugins/projectexplorer/runcontrol.h b/src/plugins/projectexplorer/runcontrol.h index 60794cb80ff..17c6ddafe7e 100644 --- a/src/plugins/projectexplorer/runcontrol.h +++ b/src/plugins/projectexplorer/runcontrol.h @@ -295,7 +295,6 @@ public: void setProcessMode(Utils::ProcessMode processMode); void suppressDefaultStdOutHandling(); - void forceRunOnHost(); signals: void stdOutData(const QByteArray &data); diff --git a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp index f37ad564a01..e5ff2811524 100644 --- a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp +++ b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp @@ -213,8 +213,7 @@ LocalQmlPreviewSupportFactory::LocalQmlPreviewSupportFactory() } cmd.addArg(qmlDebugLocalArguments(QmlPreviewServices, runControl->qmlChannel().path())); - worker->setCommandLine(cmd); - worker->forceRunOnHost(); + worker->setCommandLine(cmd.toLocal()); }); return worker; }); diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp index 5b12e2e2f5d..8fbfc664c3f 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp @@ -154,8 +154,7 @@ RunWorker *createLocalQmlProfilerWorker(RunControl *runControl) const QString oldArgs = cmd.arguments(); cmd.setArguments(arguments); cmd.addArgs(oldArgs, Utils::CommandLine::Raw); - worker->setCommandLine(cmd); - worker->forceRunOnHost(); + worker->setCommandLine(cmd.toLocal()); }); return worker;