forked from qt-creator/qt-creator
Core: Use Utils::CommandLine in ExecuteFilter
... using a new CommandLine::fromUserInput convenience function. Change-Id: Ic786530af89ec80f4211e66f36caa22cb705effe Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "commandline.h"
|
||||
|
||||
#include "environment.h"
|
||||
#include "macroexpander.h"
|
||||
#include "qtcassert.h"
|
||||
#include "stringutils.h"
|
||||
|
||||
@@ -1434,6 +1435,21 @@ CommandLine::CommandLine(const FilePath &exe, const QString &args, RawType)
|
||||
addArgs(args, Raw);
|
||||
}
|
||||
|
||||
CommandLine CommandLine::fromUserInput(const QString &cmdline, MacroExpander *expander)
|
||||
{
|
||||
CommandLine cmd;
|
||||
const int pos = cmdline.indexOf(' ');
|
||||
if (pos == -1) {
|
||||
cmd.m_executable = FilePath::fromString(cmdline);
|
||||
} else {
|
||||
cmd.m_executable = FilePath::fromString(cmdline.left(pos));
|
||||
cmd.m_arguments = cmdline.right(cmdline.length() - pos - 1);
|
||||
if (expander)
|
||||
cmd.m_arguments = expander->expand(cmd.m_arguments);
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
|
||||
void CommandLine::addArg(const QString &arg)
|
||||
{
|
||||
ProcessArgs::addArg(&m_arguments, arg, m_executable.osType());
|
||||
|
||||
Reference in New Issue
Block a user