aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-10-09 13:58:22 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2018-10-11 08:57:37 +0000
commit0934610293ca3e240cf392b99e4b3a9bf1a2570e (patch)
treec31b581413f82bcf5e1feeae2111e7ef327af100
parenta6bd01504c0b3a96b631475c57be3f3302af36ce (diff)
libqtprofilesetup: Properly handle quoted paths in .pri files
Fixes: QBS-1399 Change-Id: I52e93a1d80203337c9cedbc09386b0c6c5334f91 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--src/lib/qtprofilesetup/qtmoduleinfo.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/lib/qtprofilesetup/qtmoduleinfo.cpp b/src/lib/qtprofilesetup/qtmoduleinfo.cpp
index 95799632c..8511a6cac 100644
--- a/src/lib/qtprofilesetup/qtmoduleinfo.cpp
+++ b/src/lib/qtprofilesetup/qtmoduleinfo.cpp
@@ -643,6 +643,34 @@ static QList<QByteArray> getPriFileContentsRecursively(const Profile &profile,
return lines;
}
+static QStringList extractPaths(const QByteArray &rhs, const QString &filePath)
+{
+ QStringList paths;
+ int startIndex = 0;
+ for (;;) {
+ while (startIndex < rhs.size() && rhs.at(startIndex) == ' ')
+ ++startIndex;
+ if (startIndex >= rhs.size())
+ break;
+ int endIndex;
+ if (rhs.at(startIndex) == '"') {
+ ++startIndex;
+ endIndex = rhs.indexOf('"', startIndex);
+ if (endIndex == -1) {
+ qDebug("Unmatched quote in file '%s'", qPrintable(filePath));
+ break;
+ }
+ } else {
+ endIndex = rhs.indexOf(' ', startIndex + 1);
+ if (endIndex == -1)
+ endIndex = rhs.size();
+ }
+ paths << QString::fromLocal8Bit(rhs.mid(startIndex, endIndex - startIndex));
+ startIndex = endIndex + 1;
+ }
+ return paths;
+}
+
QList<QtModuleInfo> allQt5Modules(const Profile &profile, const QtEnvironment &qtEnvironment)
{
Internal::Set<QString> nonExistingPrlFiles;
@@ -705,7 +733,7 @@ QList<QtModuleInfo> allQt5Modules(const Profile &profile, const QtEnvironment &q
hasV2 = true;
}
} else if (key.endsWith(".includes")) {
- moduleInfo.includePaths = QString::fromLocal8Bit(value).split(QLatin1Char(' '));
+ moduleInfo.includePaths = extractPaths(value, dit.filePath());
for (auto &includePath : moduleInfo.includePaths) {
includePath
.replace(QLatin1String("$$QT_MODULE_INCLUDE_BASE"),