QtcProcess: Introduce a QtcProcess::Arguments class

This is used to get a platform-agnostic handle on "command line
arguments". It essentially wraps a single QString on Windows,
and a QStringList everywhere else.

As a consequence, several occurrences of #ifdef Q_OS_*
can be removed from the codebase.

Change-Id: Ic93118c1bd0bce0ebb58f416d395dbaebb861772
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
hjk
2014-02-05 10:43:21 +01:00
committed by Eike Ziller
parent a0d29eeb03
commit c68ebeed2e
14 changed files with 1257 additions and 1196 deletions

View File

@@ -201,11 +201,7 @@ void LldbEngine::setupInferior()
const DebuggerStartParameters &sp = startParameters();
QString executable;
#ifdef Q_OS_WIN
QString args;
#else
QStringList args;
#endif
Utils::QtcProcess::Arguments args;
Utils::QtcProcess::prepareCommand(QFileInfo(sp.executable).absoluteFilePath(),
sp.processArgs, &executable, &args);
@@ -213,12 +209,8 @@ void LldbEngine::setupInferior()
cmd.arg("executable", executable);
cmd.arg("startMode", sp.startMode); // directly relying on this is brittle wrt. insertions, so check it here
cmd.beginList("processArgs");
#ifdef Q_OS_WIN
// fixme?
#else
foreach (const QString &arg, args)
foreach (const QString &arg, args.toUnixArgs())
cmd.arg(arg.toUtf8().toHex());
#endif
cmd.endList();
// it is better not to check the start mode on the python sid (as we would have to duplicate the