diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-06-30 19:05:57 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-04 16:06:04 +0200 |
commit | 3ca4b74618a04cf6c01d0d29927f62223f201d61 (patch) | |
tree | ce6bfc16b7f56210d11f2320ed8f5b37cd2aa057 /src/corelib/io/qprocess_win.cpp | |
parent | b929ce465f3e9121f0fa3beffa184413c05f9216 (diff) |
make argument quoting code on windows less arcane
Change-Id: I6eca1d336ff770d3e5548e58137ca0053d4f63db
Reviewed-on: http://codereview.qt.nokia.com/963
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Diffstat (limited to 'src/corelib/io/qprocess_win.cpp')
-rw-r--r-- | src/corelib/io/qprocess_win.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index dba3de47a7..510f72312e 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -263,16 +263,13 @@ static QString qt_create_commandline(const QString &program, const QStringList & // The argument must not end with a \ since this would be interpreted // as escaping the quote -- rather put the \ behind the quote: e.g. // rather use "foo"\ than "foo\" - QString endQuote(QLatin1Char('\"')); int i = tmp.length(); - while (i>0 && tmp.at(i-1) == QLatin1Char('\\')) { + while (i > 0 && tmp.at(i - 1) == QLatin1Char('\\')) --i; - endQuote += QLatin1Char('\\'); - } - args += QLatin1String(" \"") + tmp.left(i) + endQuote; - } else { - args += QLatin1Char(' ') + tmp; + tmp.insert(i, QLatin1Char('"')); + tmp.prepend(QLatin1Char('"')); } + args += QLatin1Char(' ') + tmp; } return args; } |