diff --git a/src/plugins/projectexplorer/processparameters.cpp b/src/plugins/projectexplorer/processparameters.cpp index 0b3d6d83c7a..d9338ad03a2 100644 --- a/src/plugins/projectexplorer/processparameters.cpp +++ b/src/plugins/projectexplorer/processparameters.cpp @@ -35,7 +35,7 @@ ProcessParameters::ProcessParameters() = default; */ void ProcessParameters::setCommandLine(const CommandLine &cmdLine) { - m_command = cmdLine; + m_runData.command = cmdLine; m_effectiveCommand.clear(); m_effectiveArguments.clear(); @@ -51,7 +51,7 @@ void ProcessParameters::setCommandLine(const CommandLine &cmdLine) void ProcessParameters::setWorkingDirectory(const FilePath &workingDirectory) { - m_workingDirectory = workingDirectory; + m_runData.workingDirectory = workingDirectory; m_effectiveWorkingDirectory.clear(); effectiveWorkingDirectory(); @@ -79,12 +79,12 @@ void ProcessParameters::setWorkingDirectory(const FilePath &workingDirectory) FilePath ProcessParameters::effectiveWorkingDirectory() const { if (m_effectiveWorkingDirectory.isEmpty()) { - m_effectiveWorkingDirectory = m_workingDirectory; - QString path = m_workingDirectory.path(); + m_effectiveWorkingDirectory = m_runData.workingDirectory; + QString path = m_runData.workingDirectory.path(); if (m_macroExpander) path = m_macroExpander->expand(path); - m_effectiveWorkingDirectory = - m_effectiveWorkingDirectory.withNewPath(QDir::cleanPath(m_environment.expandVariables(path))); + m_effectiveWorkingDirectory = m_effectiveWorkingDirectory.withNewPath( + QDir::cleanPath(m_runData.environment.expandVariables(path))); } return m_effectiveWorkingDirectory; } @@ -96,15 +96,15 @@ FilePath ProcessParameters::effectiveWorkingDirectory() const FilePath ProcessParameters::effectiveCommand() const { if (m_effectiveCommand.isEmpty()) { - FilePath cmd = m_command.executable(); + FilePath cmd = m_runData.command.executable(); if (m_macroExpander) cmd = m_macroExpander->expand(cmd); if (cmd.needsDevice()) { // Assume this is already good. FIXME: It is possibly not, so better fix searchInPath. m_effectiveCommand = cmd; } else { - m_effectiveCommand = m_environment.searchInPath(cmd.toString(), - {effectiveWorkingDirectory()}); + m_effectiveCommand = m_runData.environment.searchInPath(cmd.toString(), + {effectiveWorkingDirectory()}); } m_commandMissing = m_effectiveCommand.isEmpty(); if (m_commandMissing) @@ -126,7 +126,7 @@ bool ProcessParameters::commandMissing() const QString ProcessParameters::effectiveArguments() const { if (m_effectiveArguments.isEmpty()) { - m_effectiveArguments = m_command.arguments(); + m_effectiveArguments = m_runData.command.arguments(); if (m_macroExpander) m_effectiveArguments = m_macroExpander->expand(m_effectiveArguments); } @@ -135,7 +135,7 @@ QString ProcessParameters::effectiveArguments() const QString ProcessParameters::prettyCommand() const { - QString cmd = m_command.executable().toString(); + QString cmd = m_runData.command.executable().toString(); if (m_macroExpander) cmd = m_macroExpander->expand(cmd); return FilePath::fromString(cmd).fileName(); @@ -143,11 +143,11 @@ QString ProcessParameters::prettyCommand() const QString ProcessParameters::prettyArguments() const { - QString margs = effectiveArguments(); - FilePath workDir = effectiveWorkingDirectory(); + const QString margs = effectiveArguments(); + const FilePath workDir = effectiveWorkingDirectory(); ProcessArgs::SplitError err; - ProcessArgs args = - ProcessArgs::prepareArgs(margs, &err, HostOsInfo::hostOs(), &m_environment, &workDir); + const ProcessArgs args = ProcessArgs::prepareArgs(margs, &err, HostOsInfo::hostOs(), + &m_runData.environment, &workDir); if (err != ProcessArgs::SplitOk) return margs; // Sorry, too complex - just fall back. return args.toString(); diff --git a/src/plugins/projectexplorer/processparameters.h b/src/plugins/projectexplorer/processparameters.h index 23ebad028dc..ce418b65c28 100644 --- a/src/plugins/projectexplorer/processparameters.h +++ b/src/plugins/projectexplorer/processparameters.h @@ -5,9 +5,7 @@ #include "projectexplorer_export.h" -#include -#include -#include +#include namespace Utils { class MacroExpander; @@ -22,13 +20,13 @@ public: ProcessParameters(); void setCommandLine(const Utils::CommandLine &cmdLine); - Utils::CommandLine command() const { return m_command; } + Utils::CommandLine command() const { return m_runData.command; } void setWorkingDirectory(const Utils::FilePath &workingDirectory); - Utils::FilePath workingDirectory() const { return m_workingDirectory; } + Utils::FilePath workingDirectory() const { return m_runData.workingDirectory; } - void setEnvironment(const Utils::Environment &env) { m_environment = env; } - Utils::Environment environment() const { return m_environment; } + void setEnvironment(const Utils::Environment &env) { m_runData.environment = env; } + Utils::Environment environment() const { return m_runData.environment; } void setMacroExpander(Utils::MacroExpander *mx) { m_macroExpander = mx; } Utils::MacroExpander *macroExpander() const { return m_macroExpander; } @@ -49,9 +47,7 @@ public: QString summaryInWorkdir(const QString &displayName) const; private: - Utils::FilePath m_workingDirectory; - Utils::CommandLine m_command; - Utils::Environment m_environment; + Utils::ProcessRunData m_runData; Utils::MacroExpander *m_macroExpander = nullptr; mutable Utils::FilePath m_effectiveWorkingDirectory;