diff options
author | hjk <hjk@qt.io> | 2021-08-12 13:04:22 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2021-08-24 07:36:04 +0000 |
commit | 20a63d6c7e080f52a5749bbc7a0997d4d5753f46 (patch) | |
tree | bf211a9d28acec5660c2d69c5dfc7619a5c6f3ea /src/libs/utils/commandline.cpp | |
parent | d735d3238f4dc97f2858b799fa79b9ee66f4219d (diff) |
Utils: Drop OsType parameter from CommandLine functions
The type is implicitly given by the command's executble FilePath.
Also, rename the rarely used addArgs(const CommandLine &) overload
to addCommandLineAsArgs() and make it strip scheme and host from
the wrapped executable as there are no uses expected where keeping
them would be the right thing.
Change-Id: Id0b76778e7e01ac16e477f36bf30bb28d96bb177
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/libs/utils/commandline.cpp')
-rw-r--r-- | src/libs/utils/commandline.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libs/utils/commandline.cpp b/src/libs/utils/commandline.cpp index de0128c3be2..e6740afb9e2 100644 --- a/src/libs/utils/commandline.cpp +++ b/src/libs/utils/commandline.cpp @@ -1434,23 +1434,23 @@ CommandLine::CommandLine(const FilePath &exe, const QString &args, RawType) addArgs(args, Raw); } -void CommandLine::addArg(const QString &arg, OsType osType) +void CommandLine::addArg(const QString &arg) { - ProcessArgs::addArg(&m_arguments, arg, osType); + ProcessArgs::addArg(&m_arguments, arg, m_executable.osType()); } -void CommandLine::addArgs(const QStringList &inArgs, OsType osType) +void CommandLine::addArgs(const QStringList &inArgs) { for (const QString &arg : inArgs) - addArg(arg, osType); + addArg(arg); } // Adds cmd's executable and arguments one by one to this commandline. // Useful for 'sudo', 'nice', etc -void CommandLine::addArgs(const CommandLine &cmd, OsType osType) +void CommandLine::addCommandLineAsArgs(const CommandLine &cmd) { - addArg(cmd.executable().toString()); - addArgs(cmd.splitArguments(osType)); + addArg(cmd.executable().path()); + addArgs(cmd.splitArguments()); } void CommandLine::addArgs(const QString &inArgs, RawType) @@ -1466,9 +1466,9 @@ QString CommandLine::toUserOutput() const return res; } -QStringList CommandLine::splitArguments(OsType osType) const +QStringList CommandLine::splitArguments() const { - return ProcessArgs::splitArgs(m_arguments, osType); + return ProcessArgs::splitArgs(m_arguments, m_executable.osType()); } } // namespace Utils |