ProjectExplorer: Prefer ProcessParameters::setCommandLine

... over setting command and args individually.

Change-Id: Iec7c8d3a0b05fb8fa0639f7ddbe7ccdc7387d2a2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-06-21 08:31:37 +02:00
parent 0d49c2cd2c
commit 3170601b4d
20 changed files with 122 additions and 162 deletions

View File

@@ -54,33 +54,17 @@ ProcessParameters::ProcessParameters() :
{
}
/*!
Sets the command to run.
*/
void ProcessParameters::setCommandLine(const CommandLine &cmdLine)
{
m_command = cmdLine.executable();
m_arguments = cmdLine.arguments();
m_command = cmdLine;
m_effectiveCommand.clear();
m_effectiveArguments.clear();
resolveAll();
}
/*!
Sets the executable to run.
*/
void ProcessParameters::setCommand(const Utils::FilePath &cmd)
{
m_command = cmd;
m_effectiveCommand.clear();
}
/*!
Sets the command line arguments used by the process.
*/
void ProcessParameters::setArguments(const QString &arguments)
{
m_arguments = arguments;
m_effectiveArguments.clear();
}
/*!
Sets the \a workingDirectory for the process for a build configuration.
@@ -132,7 +116,7 @@ FilePath ProcessParameters::effectiveWorkingDirectory() const
FilePath ProcessParameters::effectiveCommand() const
{
if (m_effectiveCommand.isEmpty()) {
FilePath cmd = m_command;
FilePath cmd = m_command.executable();
if (m_macroExpander)
cmd = m_macroExpander->expand(cmd);
m_effectiveCommand =
@@ -158,7 +142,7 @@ bool ProcessParameters::commandMissing() const
QString ProcessParameters::effectiveArguments() const
{
if (m_effectiveArguments.isEmpty()) {
m_effectiveArguments = m_arguments;
m_effectiveArguments = m_command.arguments();
if (m_macroExpander)
m_effectiveArguments = m_macroExpander->expand(m_effectiveArguments);
}
@@ -167,7 +151,7 @@ QString ProcessParameters::effectiveArguments() const
QString ProcessParameters::prettyCommand() const
{
QString cmd = m_command.toString();
QString cmd = m_command.executable().toString();
if (m_macroExpander)
cmd = m_macroExpander->expand(cmd);
return Utils::FilePath::fromString(cmd).fileName();