forked from qt-creator/qt-creator
Utils: Allow Os Type selection for CommandLine
Adds function overloads allowing users to choose the flavor of command line argument quoting. Change-Id: I24518162c286114333a93301fedc2a3329cd0c29 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1412,6 +1412,12 @@ CommandLine::CommandLine(const FilePath &exe, const QStringList &args)
|
|||||||
addArgs(args);
|
addArgs(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CommandLine::CommandLine(const FilePath &exe, const QStringList &args, OsType osType)
|
||||||
|
: m_executable(exe)
|
||||||
|
{
|
||||||
|
addArgs(args, osType);
|
||||||
|
}
|
||||||
|
|
||||||
CommandLine::CommandLine(const FilePath &exe, const QString &args, RawType)
|
CommandLine::CommandLine(const FilePath &exe, const QString &args, RawType)
|
||||||
: m_executable(exe)
|
: m_executable(exe)
|
||||||
{
|
{
|
||||||
@@ -1438,12 +1444,23 @@ void CommandLine::addArg(const QString &arg)
|
|||||||
ProcessArgs::addArg(&m_arguments, arg, m_executable.osType());
|
ProcessArgs::addArg(&m_arguments, arg, m_executable.osType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CommandLine::addArg(const QString &arg, OsType osType)
|
||||||
|
{
|
||||||
|
ProcessArgs::addArg(&m_arguments, arg, osType);
|
||||||
|
}
|
||||||
|
|
||||||
void CommandLine::addArgs(const QStringList &inArgs)
|
void CommandLine::addArgs(const QStringList &inArgs)
|
||||||
{
|
{
|
||||||
for (const QString &arg : inArgs)
|
for (const QString &arg : inArgs)
|
||||||
addArg(arg);
|
addArg(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CommandLine::addArgs(const QStringList &inArgs, OsType osType)
|
||||||
|
{
|
||||||
|
for (const QString &arg : inArgs)
|
||||||
|
addArg(arg, osType);
|
||||||
|
}
|
||||||
|
|
||||||
// Adds cmd's executable and arguments one by one to this commandline.
|
// Adds cmd's executable and arguments one by one to this commandline.
|
||||||
// Useful for 'sudo', 'nice', etc
|
// Useful for 'sudo', 'nice', etc
|
||||||
void CommandLine::addCommandLineAsArgs(const CommandLine &cmd)
|
void CommandLine::addCommandLineAsArgs(const CommandLine &cmd)
|
||||||
|
@@ -115,12 +115,15 @@ public:
|
|||||||
CommandLine();
|
CommandLine();
|
||||||
explicit CommandLine(const FilePath &executable);
|
explicit CommandLine(const FilePath &executable);
|
||||||
CommandLine(const FilePath &exe, const QStringList &args);
|
CommandLine(const FilePath &exe, const QStringList &args);
|
||||||
|
CommandLine(const FilePath &exe, const QStringList &args, OsType osType);
|
||||||
CommandLine(const FilePath &exe, const QString &unparsedArgs, RawType);
|
CommandLine(const FilePath &exe, const QString &unparsedArgs, RawType);
|
||||||
|
|
||||||
static CommandLine fromUserInput(const QString &cmdline, MacroExpander *expander = nullptr);
|
static CommandLine fromUserInput(const QString &cmdline, MacroExpander *expander = nullptr);
|
||||||
|
|
||||||
void addArg(const QString &arg);
|
void addArg(const QString &arg);
|
||||||
|
void addArg(const QString &arg, OsType osType);
|
||||||
void addArgs(const QStringList &inArgs);
|
void addArgs(const QStringList &inArgs);
|
||||||
|
void addArgs(const QStringList &inArgs, OsType osType);
|
||||||
void addArgs(const QString &inArgs, RawType);
|
void addArgs(const QString &inArgs, RawType);
|
||||||
|
|
||||||
void prependArgs(const QStringList &inArgs);
|
void prependArgs(const QStringList &inArgs);
|
||||||
|
Reference in New Issue
Block a user