diff --git a/src/libs/utils/environment.cpp b/src/libs/utils/environment.cpp index 7ec417030fa9c22afdbe9f5ce8cbc2dc5efcb9f8..b21fcf9ab63af0a0fac3d85b26c3d93d5410488f 100644 --- a/src/libs/utils/environment.cpp +++ b/src/libs/utils/environment.cpp @@ -373,20 +373,15 @@ QString Environment::joinArgumentList(const QStringList &arguments) return result; } -enum State { BASE, VARIABLE, OPTIONALVARIABLEBRACE, STRING, STRING_ESCAPE, ESCAPE }; +enum State { BASE, VARIABLE, OPTIONALVARIABLEBRACE, STRING }; /** Expand environment variables in a string. * * Environment variables are accepted in the following forms: * $SOMEVAR, ${SOMEVAR} and %SOMEVAR%. * - * The following escape sequences are supported: - * "\$", "\\" and "\"" which will be replaced by '$', '\' and '%' - * respectively. - * * Strings enclosed in '"' characters do not get varaibles - * substituted. Escape codes are processed though. - * + * substituted. */ QString Environment::expandVariables(const QString &input) const { @@ -399,9 +394,7 @@ QString Environment::expandVariables(const QString &input) const for (int i = 0; i < length; ++i) { QChar c = input.at(i); if (state == BASE) { - if (c == '\\') { - state = ESCAPE; - } else if (c == '$') { + if (c == '$') { state = OPTIONALVARIABLEBRACE; variable.clear(); endVariable = QChar(0); @@ -433,20 +426,12 @@ QString Environment::expandVariables(const QString &input) const variable = c; state = VARIABLE; } else if (state == STRING) { - if (c == '\\') { - state = STRING_ESCAPE; - } else if (c == '\"') { + if (c == '\"') { state = BASE; result += c; } else { result += c; } - } else if (state == STRING_ESCAPE) { - result += c; - state = STRING; - } else if (state == ESCAPE){ - result += c; - state = BASE; } } if (state == VARIABLE) diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index 331e51ddfa8f865151242359551e2fdea2e46b9d..844353fddf51d1ae76d74ff04e921fa133d2a82f 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -110,9 +110,7 @@ QString PathChooserPrivate::expandedPath(const QString &input) const { if (input.isEmpty()) return input; - // Environment does \-expansion, too. - const QString nativeInput = QDir::fromNativeSeparators(input); - const QString path = QDir::fromNativeSeparators(m_environment.expandVariables(nativeInput)); + const QString path = QDir::fromNativeSeparators(m_environment.expandVariables(input)); if (path.isEmpty()) return path; diff --git a/src/plugins/projectexplorer/abstractprocessstep.cpp b/src/plugins/projectexplorer/abstractprocessstep.cpp index 9949ef30452825b87cf213ec7944c9f55054a9d0..9b0786f7e826868aae37bb0a9fb9907e52aee056 100644 --- a/src/plugins/projectexplorer/abstractprocessstep.cpp +++ b/src/plugins/projectexplorer/abstractprocessstep.cpp @@ -151,13 +151,12 @@ void AbstractProcessStep::run(QFutureInterface<bool> &fi) fi.reportResult(true); return; } - QString workDir = m_environment.expandVariables(m_workingDirectory); - QDir wd(workDir); + QDir wd(m_environment.expandVariables(m_workingDirectory)); if (!wd.exists()) wd.mkpath(wd.absolutePath()); m_process = new QProcess(); - m_process->setWorkingDirectory(workDir); + m_process->setWorkingDirectory(wd.absolutePath()); m_process->setEnvironment(m_environment.toStringList()); connect(m_process, SIGNAL(readyReadStandardOutput()),