forked from qt-creator/qt-creator
Macro expander: Allow alternative substitution character
The forward slash is a poor choice on Windows for fields containing file paths, as it gets auto-converted to a backslash when used in a path chooser. Fixes: QTCREATORBUG-22276 Change-Id: I1d22d2031909b24c72aad4781995418efd394039 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -136,6 +136,7 @@ bool AbstractMacroExpander::expandNestedMacros(const QString &str, int *pos, QSt
|
||||
QString *currArg = &varName;
|
||||
QChar prev;
|
||||
QChar c;
|
||||
QChar replacementChar;
|
||||
bool replaceAll = false;
|
||||
|
||||
int i = *pos;
|
||||
@@ -192,13 +193,14 @@ bool AbstractMacroExpander::expandNestedMacros(const QString &str, int *pos, QSt
|
||||
} else if (currArg == &varName && c == '-' && prev == ':' && validateVarName(varName)) {
|
||||
varName.chop(1);
|
||||
currArg = &defaultValue;
|
||||
} else if (currArg == &varName && c == '/' && validateVarName(varName)) {
|
||||
} else if (currArg == &varName && (c == '/' || c == '#') && validateVarName(varName)) {
|
||||
replacementChar = c;
|
||||
currArg = &pattern;
|
||||
if (i < strLen && str.at(i) == '/') {
|
||||
if (i < strLen && str.at(i) == replacementChar) {
|
||||
++i;
|
||||
replaceAll = true;
|
||||
}
|
||||
} else if (currArg == &pattern && c == '/') {
|
||||
} else if (currArg == &pattern && c == replacementChar) {
|
||||
currArg = &replace;
|
||||
} else {
|
||||
*currArg += c;
|
||||
|
||||
Reference in New Issue
Block a user