From c5e87aa0c1b9e623b9c4e625baeffc9ea9bccfe1 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 21 Aug 2012 17:28:52 +0200 Subject: [PATCH] make $$shell_{path,quote}() use correct path separator follow suit with qmake ... Change-Id: I0221f6c81bc770c37f501d79c31860549c0c0076 Reviewed-by: Daniel Teske --- src/shared/proparser/qmakebuiltins.cpp | 4 ++-- src/shared/proparser/qmakeevaluator.cpp | 3 +++ src/shared/proparser/qmakeevaluator.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/shared/proparser/qmakebuiltins.cpp b/src/shared/proparser/qmakebuiltins.cpp index 4e41e3f4833..38ebcdc4c77 100644 --- a/src/shared/proparser/qmakebuiltins.cpp +++ b/src/shared/proparser/qmakebuiltins.cpp @@ -1009,7 +1009,7 @@ ProStringList QMakeEvaluator::evaluateExpandFunction( evalError(fL1S("shell_path(path) requires one argument.")); } else { QString rstr = args.at(0).toQString(m_tmp1); - if (m_option->dir_sep.at(0) != QLatin1Char('/')) + if (m_dirSep.startsWith(QLatin1Char('\\'))) rstr.replace(QLatin1Char('/'), QLatin1Char('\\')); else rstr.replace(QLatin1Char('\\'), QLatin1Char('/')); @@ -1029,7 +1029,7 @@ ProStringList QMakeEvaluator::evaluateExpandFunction( evalError(fL1S("shell_quote(arg) requires one argument.")); } else { QString rstr = args.at(0).toQString(m_tmp1); - if (m_option->dir_sep.at(0) != QLatin1Char('/')) + if (m_dirSep.startsWith(QLatin1Char('\\'))) rstr = IoUtils::shellQuoteWin(rstr); else rstr = IoUtils::shellQuoteUnix(rstr); diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp index 801a2278353..b017dcdcadb 100644 --- a/src/shared/proparser/qmakeevaluator.cpp +++ b/src/shared/proparser/qmakeevaluator.cpp @@ -201,6 +201,7 @@ void QMakeEvaluator::initFrom(const QMakeEvaluator &other) m_qmakespecName = other.m_qmakespecName; m_mkspecPaths = other.m_mkspecPaths; m_featureRoots = other.m_featureRoots; + m_dirSep = other.m_dirSep; } //////// Evaluator tools ///////// @@ -1105,6 +1106,8 @@ bool QMakeEvaluator::loadSpec() if (!evaluateFeatureFile(QLatin1String("spec_post.prf"))) return false; updateFeaturePaths(); // The spec extends the feature search path, so rebuild the cache. + // The MinGW and x-build specs may change the separator; $$shell_{path,quote}() need it + m_dirSep = first(ProKey("QMAKE_DIR_SEP")); if (!m_conffile.isEmpty() && !evaluateFileDirect(m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly)) { return false; diff --git a/src/shared/proparser/qmakeevaluator.h b/src/shared/proparser/qmakeevaluator.h index d62e2765fdd..970a18b0115 100644 --- a/src/shared/proparser/qmakeevaluator.h +++ b/src/shared/proparser/qmakeevaluator.h @@ -233,6 +233,7 @@ public: QStringList m_qmakefeatures; QStringList m_mkspecPaths; QStringList m_featureRoots; + ProString m_dirSep; ProFunctionDefs m_functionDefs; ProStringList m_returnValue; QStack m_valuemapStack; // VariableName must be us-ascii, the content however can be non-us-ascii.