forked from qt-creator/qt-creator
Utils: Add "addCommandLine..." functions
addCommandLineAsSingleArg allows to reliably create commandlines like "bash -c 'echo ...'" addCommandLineWithAnd combines two command lines by adding '&&' in between Change-Id: Ic5af34c90fd5271dced40ba1341a3df019ededb8 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1473,6 +1473,26 @@ void CommandLine::addCommandLineAsArgs(const CommandLine &cmd, RawType)
|
||||
addArgs(cmd.arguments(), Raw);
|
||||
}
|
||||
|
||||
void CommandLine::addCommandLineAsSingleArg(const CommandLine &cmd)
|
||||
{
|
||||
QString combined;
|
||||
ProcessArgs::addArg(&combined, cmd.executable().path());
|
||||
ProcessArgs::addArgs(&combined, cmd.arguments());
|
||||
|
||||
addArg(combined);
|
||||
}
|
||||
|
||||
void CommandLine::addCommandLineWithAnd(const CommandLine &cmd)
|
||||
{
|
||||
if (m_executable.isEmpty()) {
|
||||
*this = cmd;
|
||||
return;
|
||||
}
|
||||
|
||||
addArgs("&&", Raw);
|
||||
addCommandLineAsArgs(cmd);
|
||||
}
|
||||
|
||||
void CommandLine::addArgs(const QString &inArgs, RawType)
|
||||
{
|
||||
ProcessArgs::addArgs(&m_arguments, inArgs);
|
||||
|
||||
Reference in New Issue
Block a user