forked from qt-creator/qt-creator
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
This commit is contained in:
@@ -81,7 +81,10 @@ static QString quoteWinArgument(const QString &arg)
|
|||||||
// The argument must not end with a \ since this would be interpreted
|
// The argument must not end with a \ since this would be interpreted
|
||||||
// as escaping the quote -- rather put the \ behind the quote: e.g.
|
// as escaping the quote -- rather put the \ behind the quote: e.g.
|
||||||
// rather use "foo"\ than "foo\"
|
// 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('"'));
|
ret.prepend(QLatin1Char('"'));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
Reference in New Issue
Block a user