Commit 600127e8 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen

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 and consoleprocess before ...

Change-Id: I62b80fb4ea68e00145861f289bc13440c5078873
Reviewed-on: http://codereview.qt.nokia.com/1302Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@nokia.com>
Reviewed-by: default avatarOswald Buddenhagen <oswald.buddenhagen@nokia.com>
parent 17623c87
......@@ -568,7 +568,10 @@ QString QtcProcess::quoteArg(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('"'));
}
// FIXME: Without this, quoting is not foolproof. But it needs support in the process setup, etc.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment