diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-04-26 10:31:28 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-04-26 10:45:04 +0200 |
commit | 6c5647c18d81233fbc9737e89ba8eb696be4726e (patch) | |
tree | 6637d10d6dbbb9bb9abc593c4bab187316af93dc | |
parent | 444fd5ee191419af916bbc656583a38f38fdde14 (diff) |
fix quoting of strings with spaces and backslashes at the end
the regexp would match twice at the end, and thus insert a stray quote.
so use a discrete loop instead.
fixed the same thing in proparser/ioutils before ...
Task-number: QTCREATORBUG-4291
-rw-r--r-- | src/libs/utils/abstractprocess_win.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libs/utils/abstractprocess_win.cpp b/src/libs/utils/abstractprocess_win.cpp index 194c67e222c..4bc7c089529 100644 --- a/src/libs/utils/abstractprocess_win.cpp +++ b/src/libs/utils/abstractprocess_win.cpp @@ -81,7 +81,10 @@ static QString quoteWinArgument(const QString &arg) // 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\" - ret.replace(QRegExp(QLatin1String("(\\\\*)$")), QLatin1String("\"\\1")); + int i = ret.length(); + while (i > 0 && ret.at(i - 1) == QLatin1Char('\\')) + --i; + ret.insert(i, QLatin1Char('"')); ret.prepend(QLatin1Char('"')); } return ret; |