forked from qt-creator/qt-creator
QtcProcess: Port to QRegularExpression
Task-number: QTCREATORBUG-24098 Change-Id: I9784989786ff65ceac6c9921f7f9f09d4e0f0a49 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
#include <QCoreApplication>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QStack>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
@@ -583,7 +583,7 @@ static QString quoteArgWin(const QString &arg)
|
||||
// Quotes are escaped and their preceding backslashes are doubled.
|
||||
// It's impossible to escape anything inside a quoted string on cmd
|
||||
// level, so the outer quoting must be "suspended".
|
||||
ret.replace(QRegExp(QLatin1String("(\\\\*)\"")), QLatin1String("\"\\1\\1\\^\"\""));
|
||||
ret.replace(QRegularExpression(QLatin1String("(\\\\*)\"")), QLatin1String("\"\\1\\1\\^\"\""));
|
||||
// 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\"
|
||||
@@ -1062,7 +1062,7 @@ bool QtcProcess::expandMacros(QString *cmd, AbstractMacroExpander *mx, OsType os
|
||||
// Our expansion rules trigger in any context
|
||||
if (state.dquote) {
|
||||
// We are within a double-quoted string. Escape relevant meta characters.
|
||||
rsts.replace(QRegExp(QLatin1String("([$`\"\\\\])")), QLatin1String("\\\\1"));
|
||||
rsts.replace(QRegularExpression(QLatin1String("([$`\"\\\\])")), QLatin1String("\\\\1"));
|
||||
} else if (state.current == MxSingleQuote) {
|
||||
// We are within a single-quoted string. "Suspend" single-quoting and put a
|
||||
// single escaped quote for each single quote inside the string.
|
||||
|
||||
Reference in New Issue
Block a user