diff --git a/src/libs/utils/commandline.cpp b/src/libs/utils/commandline.cpp index 725fbeea24b..77e33fc83bc 100644 --- a/src/libs/utils/commandline.cpp +++ b/src/libs/utils/commandline.cpp @@ -1412,6 +1412,12 @@ CommandLine::CommandLine(const FilePath &exe, const QStringList &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) : m_executable(exe) { @@ -1438,12 +1444,23 @@ void CommandLine::addArg(const QString &arg) 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) { for (const QString &arg : inArgs) 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. // Useful for 'sudo', 'nice', etc void CommandLine::addCommandLineAsArgs(const CommandLine &cmd) diff --git a/src/libs/utils/commandline.h b/src/libs/utils/commandline.h index 99558f5d147..67e08b7fe4d 100644 --- a/src/libs/utils/commandline.h +++ b/src/libs/utils/commandline.h @@ -115,12 +115,15 @@ public: CommandLine(); explicit CommandLine(const FilePath &executable); CommandLine(const FilePath &exe, const QStringList &args); + CommandLine(const FilePath &exe, const QStringList &args, OsType osType); CommandLine(const FilePath &exe, const QString &unparsedArgs, RawType); static CommandLine fromUserInput(const QString &cmdline, MacroExpander *expander = nullptr); void addArg(const QString &arg); + void addArg(const QString &arg, OsType osType); void addArgs(const QStringList &inArgs); + void addArgs(const QStringList &inArgs, OsType osType); void addArgs(const QString &inArgs, RawType); void prependArgs(const QStringList &inArgs);