aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJarek Kobus <[email protected]>2022-01-18 17:40:19 +0100
committerJarek Kobus <[email protected]>2022-01-18 17:18:34 +0000
commitd6f56254d1d93a78fb9069945a1931412c4e0ae6 (patch)
treeff661aa6bda6707e9872ede3bd147a9ad00033b3 /src
parent2499b8896604e8b0ec8b93b763ec6d3659655fa7 (diff)
Get rid of QtcProcess::workingDirectory() overload
Adapt all callers' code so that it passes the FilePath instead of QString. As a consequence introduce TemporaryDirectory::masterDirectoryFilePath() and use it where easily possible. Change-Id: I14564949b3b916921e32a2957c84c03d1da43af2 Reviewed-by: hjk <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/libs/utils/qtcprocess.cpp5
-rw-r--r--src/libs/utils/qtcprocess.h1
-rw-r--r--src/libs/utils/temporarydirectory.cpp5
-rw-r--r--src/libs/utils/temporarydirectory.h1
-rw-r--r--src/plugins/clearcase/clearcasesync.cpp2
-rw-r--r--src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp2
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp4
-rw-r--r--src/plugins/debugger/debuggerruncontrol.cpp2
-rw-r--r--src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp4
-rw-r--r--src/plugins/docker/dockerdevice.cpp2
-rw-r--r--src/plugins/git/mergetool.cpp2
-rw-r--r--src/plugins/languageclient/languageclientinterface.cpp4
-rw-r--r--src/plugins/languageclient/languageclientinterface.h2
-rw-r--r--src/plugins/languageclient/languageclientsettings.cpp2
-rw-r--r--src/plugins/perforce/perforceplugin.cpp12
-rw-r--r--src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp8
-rw-r--r--src/plugins/projectexplorer/extracompiler.cpp2
-rw-r--r--src/plugins/projectexplorer/msvctoolchain.cpp4
-rw-r--r--src/plugins/winrt/winrtrunnerhelper.cpp9
-rw-r--r--src/plugins/winrt/winrtrunnerhelper.h3
20 files changed, 38 insertions, 38 deletions
diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp
index 1beea701efd..aed8955de2c 100644
--- a/src/libs/utils/qtcprocess.cpp
+++ b/src/libs/utils/qtcprocess.cpp
@@ -678,11 +678,6 @@ void QtcProcess::setWorkingDirectory(const FilePath &dir)
d->m_workingDirectory = dir;
}
-void QtcProcess::setWorkingDirectory(const QString &dir)
-{
- setWorkingDirectory(FilePath::fromString(dir));
-}
-
void QtcProcess::setUseCtrlCStub(bool enabled)
{
// Do not use the stub in debug mode. Activating the stub will shut down
diff --git a/src/libs/utils/qtcprocess.h b/src/libs/utils/qtcprocess.h
index 59c1769af6d..a17f46a06f9 100644
--- a/src/libs/utils/qtcprocess.h
+++ b/src/libs/utils/qtcprocess.h
@@ -99,7 +99,6 @@ public:
FilePath workingDirectory() const;
void setWorkingDirectory(const FilePath &dir);
- void setWorkingDirectory(const QString &dir); // FIXME: Kept to ease downstream transition
void setUseCtrlCStub(bool enabled);
void setLowPriority();
diff --git a/src/libs/utils/temporarydirectory.cpp b/src/libs/utils/temporarydirectory.cpp
index 2c30606e9b0..9ffbf45a017 100644
--- a/src/libs/utils/temporarydirectory.cpp
+++ b/src/libs/utils/temporarydirectory.cpp
@@ -66,6 +66,11 @@ QString TemporaryDirectory::masterDirectoryPath()
return m_masterTemporaryDir->path();
}
+FilePath TemporaryDirectory::masterDirectoryFilePath()
+{
+ return FilePath::fromString(TemporaryDirectory::masterDirectoryPath());
+}
+
FilePath TemporaryDirectory::path() const
{
return FilePath::fromString(QTemporaryDir::path());
diff --git a/src/libs/utils/temporarydirectory.h b/src/libs/utils/temporarydirectory.h
index 42390a9a0f2..22b49dc9e1b 100644
--- a/src/libs/utils/temporarydirectory.h
+++ b/src/libs/utils/temporarydirectory.h
@@ -41,6 +41,7 @@ public:
static QTemporaryDir *masterTemporaryDirectory();
static void setMasterTemporaryDirectory(const QString &pattern);
static QString masterDirectoryPath();
+ static FilePath masterDirectoryFilePath();
FilePath path() const;
FilePath filePath(const QString &fileName) const;
diff --git a/src/plugins/clearcase/clearcasesync.cpp b/src/plugins/clearcase/clearcasesync.cpp
index fff514f5c1c..baed0cb1d99 100644
--- a/src/plugins/clearcase/clearcasesync.cpp
+++ b/src/plugins/clearcase/clearcasesync.cpp
@@ -51,7 +51,7 @@ static void runProcess(QFutureInterface<void> &future,
{
const QString viewRoot = ClearCasePlugin::viewData().root;
QtcProcess process;
- process.setWorkingDirectory(viewRoot);
+ process.setWorkingDirectory(FilePath::fromString(viewRoot));
process.setCommand({FilePath::fromString(settings.ccBinaryPath), args});
process.start();
if (!process.waitForStarted())
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
index beacad9706d..5817ace058a 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
@@ -935,7 +935,7 @@ void CMakeBuildSystem::runCTest()
QTC_ASSERT(parameters.isValid(), return);
const CommandLine cmd { m_ctestPath, { "-N", "--show-only=json-v1" } };
- const QString workingDirectory = buildDirectory(parameters).toString();
+ const FilePath workingDirectory = buildDirectory(parameters);
const Environment environment = cmakeBuildConfiguration()->environment();
auto future = Utils::runAsync([cmd, workingDirectory, environment]
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index b15fb07569e..ae727383d26 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -1994,8 +1994,8 @@ void DebuggerPluginPrivate::dumpLog()
LogWindow *logWindow = engine->logWindow();
QTC_ASSERT(logWindow, return);
- FilePath filePath = FileUtils::getSaveFilePath(nullptr, tr("Save Debugger Log"),
- FilePath::fromString(TemporaryDirectory::masterDirectoryPath()));
+ const FilePath filePath = FileUtils::getSaveFilePath(nullptr, tr("Save Debugger Log"),
+ TemporaryDirectory::masterDirectoryFilePath());
if (filePath.isEmpty())
return;
FileSaver saver(filePath);
diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp
index 3d7a4f2aba3..a7bc693db8c 100644
--- a/src/plugins/debugger/debuggerruncontrol.cpp
+++ b/src/plugins/debugger/debuggerruncontrol.cpp
@@ -134,7 +134,7 @@ private:
m_tempCoreFilePath = FilePath::fromString(tmp.fileName());
}
- m_coreUnpackProcess.setWorkingDirectory(FilePath::fromString(TemporaryDirectory::masterDirectoryPath()));
+ m_coreUnpackProcess.setWorkingDirectory(TemporaryDirectory::masterDirectoryFilePath());
connect(&m_coreUnpackProcess, &QtcProcess::finished, this, &CoreUnpacker::reportStarted);
const QString msg = DebuggerRunTool::tr("Unpacking core file to %1");
diff --git a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp
index 9ac3cee8eeb..9fb662bc4e5 100644
--- a/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp
+++ b/src/plugins/debugger/shared/cdbsymbolpathlisteditor.cpp
@@ -153,7 +153,7 @@ CdbSymbolPathListEditor::CdbSymbolPathListEditor(QWidget *parent) :
bool CdbSymbolPathListEditor::promptCacheDirectory(QWidget *parent, FilePath *cacheDirectory)
{
CacheDirectoryDialog dialog(parent);
- dialog.setPath(FilePath::fromString(TemporaryDirectory::masterDirectoryPath()) + "/symbolcache");
+ dialog.setPath(TemporaryDirectory::masterDirectoryFilePath() + "/symbolcache");
if (dialog.exec() != QDialog::Accepted)
return false;
*cacheDirectory = dialog.path();
@@ -179,7 +179,7 @@ void CdbSymbolPathListEditor::setupSymbolPaths()
if (path.isEmpty() && indexOfSymbolCache != -1)
path = FilePath::fromString(currentPaths.at(indexOfSymbolCache));
if (path.isEmpty())
- path = FilePath::fromString(TemporaryDirectory::masterDirectoryPath() + "/symbolcache");
+ path = TemporaryDirectory::masterDirectoryFilePath() + "/symbolcache";
bool useSymbolServer = true;
bool useSymbolCache = true;
diff --git a/src/plugins/docker/dockerdevice.cpp b/src/plugins/docker/dockerdevice.cpp
index d728018c3b5..6b5316b6abd 100644
--- a/src/plugins/docker/dockerdevice.cpp
+++ b/src/plugins/docker/dockerdevice.cpp
@@ -1721,7 +1721,7 @@ bool DockerDevicePrivate::runInContainer(const CommandLine &cmd) const
QtcProcess proc;
proc.setCommand(dcmd);
- proc.setWorkingDirectory(QDir::tempPath());
+ proc.setWorkingDirectory(FilePath::fromString(QDir::tempPath()));
proc.start();
proc.waitForFinished();
diff --git a/src/plugins/git/mergetool.cpp b/src/plugins/git/mergetool.cpp
index 6343c408f2b..c84273f438a 100644
--- a/src/plugins/git/mergetool.cpp
+++ b/src/plugins/git/mergetool.cpp
@@ -59,7 +59,7 @@ bool MergeTool::start(const FilePath &workingDirectory, const QStringList &files
env.set("LANG", "C");
env.set("LANGUAGE", "C");
m_process = new QtcProcess(ProcessMode::Writer);
- m_process->setWorkingDirectory(workingDirectory.toString());
+ m_process->setWorkingDirectory(workingDirectory);
m_process->setEnvironment(env);
m_process->setProcessChannelMode(QProcess::MergedChannels);
const Utils::FilePath binary = GitClient::instance()->vcsBinary();
diff --git a/src/plugins/languageclient/languageclientinterface.cpp b/src/plugins/languageclient/languageclientinterface.cpp
index affd0fa7266..b2ac3836be9 100644
--- a/src/plugins/languageclient/languageclientinterface.cpp
+++ b/src/plugins/languageclient/languageclientinterface.cpp
@@ -113,12 +113,12 @@ bool StdIOClientInterface::start()
return true;
}
-void StdIOClientInterface::setCommandLine(const Utils::CommandLine &cmd)
+void StdIOClientInterface::setCommandLine(const CommandLine &cmd)
{
m_process.setCommand(cmd);
}
-void StdIOClientInterface::setWorkingDirectory(const QString &workingDirectory)
+void StdIOClientInterface::setWorkingDirectory(const FilePath &workingDirectory)
{
m_process.setWorkingDirectory(workingDirectory);
}
diff --git a/src/plugins/languageclient/languageclientinterface.h b/src/plugins/languageclient/languageclientinterface.h
index a53190b40d5..17cf222fd3f 100644
--- a/src/plugins/languageclient/languageclientinterface.h
+++ b/src/plugins/languageclient/languageclientinterface.h
@@ -80,7 +80,7 @@ public:
// These functions only have an effect if they are called before start
void setCommandLine(const Utils::CommandLine &cmd);
- void setWorkingDirectory(const QString &workingDirectory);
+ void setWorkingDirectory(const Utils::FilePath &workingDirectory);
protected:
void sendData(const QByteArray &data) final;
diff --git a/src/plugins/languageclient/languageclientsettings.cpp b/src/plugins/languageclient/languageclientsettings.cpp
index f6b02a766c4..e994fefb498 100644
--- a/src/plugins/languageclient/languageclientsettings.cpp
+++ b/src/plugins/languageclient/languageclientsettings.cpp
@@ -743,7 +743,7 @@ BaseClientInterface *StdIOSettings::createInterfaceWithProject(ProjectExplorer::
auto interface = new StdIOClientInterface;
interface->setCommandLine(command());
if (project)
- interface->setWorkingDirectory(project->projectDirectory().toString());
+ interface->setWorkingDirectory(project->projectDirectory());
return interface;
}
diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp
index aa95efbb9c5..fcc7465db33 100644
--- a/src/plugins/perforce/perforceplugin.cpp
+++ b/src/plugins/perforce/perforceplugin.cpp
@@ -300,13 +300,13 @@ public:
const QByteArray &stdInput = {},
QTextCodec *outputCodec = nullptr) const;
- PerforceResponse synchronousProcess(const QString &workingDir,
+ PerforceResponse synchronousProcess(const FilePath &workingDir,
const QStringList &args,
unsigned flags,
const QByteArray &stdInput,
QTextCodec *outputCodec) const;
- PerforceResponse fullySynchronousProcess(const QString &workingDir,
+ PerforceResponse fullySynchronousProcess(const FilePath &workingDir,
const QStringList &args,
unsigned flags,
const QByteArray &stdInput,
@@ -1238,7 +1238,7 @@ static inline QString msgExitCode(int ex)
}
// Run using a SynchronousProcess, emitting signals to the message window
-PerforceResponse PerforcePluginPrivate::synchronousProcess(const QString &workingDir,
+PerforceResponse PerforcePluginPrivate::synchronousProcess(const FilePath &workingDir,
const QStringList &args,
unsigned flags,
const QByteArray &stdInput,
@@ -1300,7 +1300,7 @@ PerforceResponse PerforcePluginPrivate::synchronousProcess(const QString &workin
}
// Run using a QProcess, for short queries
-PerforceResponse PerforcePluginPrivate::fullySynchronousProcess(const QString &workingDir,
+PerforceResponse PerforcePluginPrivate::fullySynchronousProcess(const FilePath &workingDir,
const QStringList &args,
unsigned flags,
const QByteArray &stdInput,
@@ -1388,8 +1388,8 @@ PerforceResponse PerforcePluginPrivate::runP4Cmd(const FilePath &workingDir,
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
const PerforceResponse response = (flags & RunFullySynchronous) ?
- fullySynchronousProcess(workingDir.toString(), actualArgs, flags, stdInput, outputCodec) :
- synchronousProcess(workingDir.toString(), actualArgs, flags, stdInput, outputCodec);
+ fullySynchronousProcess(workingDir, actualArgs, flags, stdInput, outputCodec) :
+ synchronousProcess(workingDir, actualArgs, flags, stdInput, outputCodec);
if (flags & ShowBusyCursor)
QApplication::restoreOverrideCursor();
diff --git a/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp b/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp
index bb2253bdf25..1b68a68dd44 100644
--- a/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp
+++ b/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp
@@ -78,7 +78,7 @@ QStringList fixGeneratorScript(const QString &configFile, QString binary)
// Helper for running the optional generation script.
static bool
- runGenerationScriptHelper(const QString &workingDirectory,
+ runGenerationScriptHelper(const FilePath &workingDirectory,
const QStringList &script,
const QList<GeneratorScriptArgument> &argumentsIn,
bool dryRun,
@@ -112,7 +112,7 @@ static bool
process.setTimeoutS(30);
const Utils::CommandLine cmd(FilePath::fromString(binary), arguments);
if (CustomWizard::verbose())
- qDebug("In %s, running:\n%s\n", qPrintable(workingDirectory),
+ qDebug("In %s, running:\n%s\n", qPrintable(workingDirectory.toUserOutput()),
qPrintable(cmd.toUserOutput()));
process.setCommand(cmd);
process.setProcessUserEventWhileRunning();
@@ -150,7 +150,7 @@ Core::GeneratedFiles
{
// Run in temporary directory as the target path may not exist yet.
QString stdOut;
- if (!runGenerationScriptHelper(Utils::TemporaryDirectory::masterDirectoryPath(),
+ if (!runGenerationScriptHelper(Utils::TemporaryDirectory::masterDirectoryFilePath(),
script, arguments, true, fieldMap, &stdOut, errorMessage))
return Core::GeneratedFiles();
Core::GeneratedFiles files;
@@ -232,7 +232,7 @@ bool runCustomWizardGeneratorScript(const QString &targetPath,
const QMap<QString, QString> &fieldMap,
QString *errorMessage)
{
- return runGenerationScriptHelper(targetPath, script, arguments,
+ return runGenerationScriptHelper(FilePath::fromString(targetPath), script, arguments,
false, fieldMap,
nullptr, errorMessage);
}
diff --git a/src/plugins/projectexplorer/extracompiler.cpp b/src/plugins/projectexplorer/extracompiler.cpp
index e18df2b0f36..36a8d68b889 100644
--- a/src/plugins/projectexplorer/extracompiler.cpp
+++ b/src/plugins/projectexplorer/extracompiler.cpp
@@ -415,7 +415,7 @@ void ProcessExtraCompiler::runInThread(
process.setEnvironment(env);
if (!workDir.isEmpty())
- process.setWorkingDirectory(workDir.toString());
+ process.setWorkingDirectory(workDir);
process.setCommand({ cmd, args });
process.setWriteData(sourceContents);
process.start();
diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp
index 20df2bcd31c..322b54e02d8 100644
--- a/src/plugins/projectexplorer/msvctoolchain.cpp
+++ b/src/plugins/projectexplorer/msvctoolchain.cpp
@@ -638,7 +638,7 @@ Macros MsvcToolChain::msvcPredefinedMacros(const QStringList &cxxflags,
}
Utils::QtcProcess cpp;
cpp.setEnvironment(env);
- cpp.setWorkingDirectory(Utils::TemporaryDirectory::masterDirectoryPath());
+ cpp.setWorkingDirectory(Utils::TemporaryDirectory::masterDirectoryFilePath());
QStringList arguments;
const Utils::FilePath binary = env.searchInPath(QLatin1String("cl.exe"));
if (binary.isEmpty()) {
@@ -1766,7 +1766,7 @@ Macros ClangClToolChain::msvcPredefinedMacros(const QStringList &cxxflags,
QtcProcess cpp;
cpp.setEnvironment(env);
- cpp.setWorkingDirectory(Utils::TemporaryDirectory::masterDirectoryPath());
+ cpp.setWorkingDirectory(Utils::TemporaryDirectory::masterDirectoryFilePath());
QStringList arguments = cxxflags;
arguments.append(gccPredefinedMacrosOptions(language()));
diff --git a/src/plugins/winrt/winrtrunnerhelper.cpp b/src/plugins/winrt/winrtrunnerhelper.cpp
index c2a09585fbe..bccfebe50ff 100644
--- a/src/plugins/winrt/winrtrunnerhelper.cpp
+++ b/src/plugins/winrt/winrtrunnerhelper.cpp
@@ -69,7 +69,7 @@ WinRtRunnerHelper::WinRtRunnerHelper(ProjectExplorer::RunWorker *runWorker, QStr
return;
}
- m_executableFilePath = runControl->targetFilePath().toString();
+ m_executableFilePath = runControl->targetFilePath();
if (m_executableFilePath.isEmpty()) {
*errorMessage = tr("Cannot determine the executable file path for \"%1\".")
@@ -79,8 +79,7 @@ WinRtRunnerHelper::WinRtRunnerHelper(ProjectExplorer::RunWorker *runWorker, QStr
// ### we should not need to append ".exe" here.
if (!m_executableFilePath.endsWith(QLatin1String(".exe")))
- m_executableFilePath += QStringLiteral(".exe");
-
+ m_executableFilePath = m_executableFilePath + QStringLiteral(".exe");
bool loopbackExemptClient = false;
bool loopbackExemptServer = false;
@@ -205,7 +204,7 @@ void WinRtRunnerHelper::startWinRtRunner(const RunConf &conf)
cmdLine.addArgs({"--profile", "appxphone"});
cmdLine.addArgs(m_loopbackArguments);
- cmdLine.addArg(m_executableFilePath);
+ cmdLine.addArg(m_executableFilePath.toString());
cmdLine.addArgs(m_arguments, CommandLine::Raw);
appendMessage(cmdLine.toUserOutput(), NormalMessageFormat);
@@ -221,6 +220,6 @@ void WinRtRunnerHelper::startWinRtRunner(const RunConf &conf)
process->setUseCtrlCStub(true);
process->setCommand(cmdLine);
process->setEnvironment(m_worker->runControl()->buildEnvironment());
- process->setWorkingDirectory(QFileInfo(m_executableFilePath).absolutePath());
+ process->setWorkingDirectory(m_executableFilePath.absolutePath());
process->start();
}
diff --git a/src/plugins/winrt/winrtrunnerhelper.h b/src/plugins/winrt/winrtrunnerhelper.h
index e5269a07265..1e790de56aa 100644
--- a/src/plugins/winrt/winrtrunnerhelper.h
+++ b/src/plugins/winrt/winrtrunnerhelper.h
@@ -28,6 +28,7 @@
#include "winrtdevice.h"
#include <utils/environment.h>
+#include <utils/filepath.h>
#include <utils/outputformat.h>
#include <QObject>
@@ -72,7 +73,7 @@ private:
ProjectExplorer::RunWorker *m_worker = nullptr;
WinRtDevice::ConstPtr m_device;
QString m_runnerFilePath;
- QString m_executableFilePath;
+ Utils::FilePath m_executableFilePath;
QString m_debuggerExecutable;
QString m_debuggerArguments;
QString m_arguments;