diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2017-11-22 15:00:17 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2017-11-23 10:31:10 +0000 |
commit | 757dede7866a39f186feb9db4d67bad4a60c2894 (patch) | |
tree | 9d6d764a1be8cc23fb150ced8ab43befd634184f | |
parent | 9ecc36e2eb1f8e12cf6537cad40acbf3890ed156 (diff) |
Fix bogus error message about conflicting module files
This could happen if the same location appeared in the search path in
different forms. We now canonicalize the paths.
Change-Id: Ide20886e88469fbbabc74f2814754b85983e6780
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
-rw-r--r-- | src/lib/corelib/language/itemreader.cpp | 10 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/choose-module-instance/choose-module-instance.qbs | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/corelib/language/itemreader.cpp b/src/lib/corelib/language/itemreader.cpp index b7e00de1c..e4dedc3c2 100644 --- a/src/lib/corelib/language/itemreader.cpp +++ b/src/lib/corelib/language/itemreader.cpp @@ -43,11 +43,19 @@ #include <tools/profiling.h> +#include <QtCore/qfileinfo.h> + #include <algorithm> namespace qbs { namespace Internal { +void makePathsCanonical(QStringList &paths) +{ + for (QString &p : paths) + p = QFileInfo(p).canonicalFilePath(); +} + ItemReader::ItemReader(Logger &logger) : m_visitorState(new ItemReaderVisitorState(logger)) { } @@ -60,12 +68,14 @@ ItemReader::~ItemReader() void ItemReader::setSearchPaths(const QStringList &searchPaths) { m_searchPaths = searchPaths; + makePathsCanonical(m_searchPaths); m_allSearchPaths.clear(); } void ItemReader::pushExtraSearchPaths(const QStringList &extraSearchPaths) { m_extraSearchPaths.push_back(extraSearchPaths); + makePathsCanonical(m_extraSearchPaths.back()); m_allSearchPaths.clear(); } diff --git a/tests/auto/blackbox/testdata/choose-module-instance/choose-module-instance.qbs b/tests/auto/blackbox/testdata/choose-module-instance/choose-module-instance.qbs index 9c95dbcdf..fb1f04d83 100644 --- a/tests/auto/blackbox/testdata/choose-module-instance/choose-module-instance.qbs +++ b/tests/auto/blackbox/testdata/choose-module-instance/choose-module-instance.qbs @@ -1,6 +1,8 @@ import qbs +import qbs.FileInfo Project { + qbsSearchPaths: [".", path, "modules/..", FileInfo.path(FileInfo.joinPaths(path, "modules"))] Product { Depends { name: "limerick" } type: ["text"] |