summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-03-18 23:17:17 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-03-22 23:09:16 (GMT)
commit2b098cd37d86bc7c843225412c90948affb8fef1 (patch)
treef4d21eb994ebdb8780f889cff27fb72684dbe3e4 /src/declarative
parent83e395ba6de068ac4ecece860cc429a4697445d0 (diff)
downloadQt-2b098cd37d86bc7c843225412c90948affb8fef1.zip
Qt-2b098cd37d86bc7c843225412c90948affb8fef1.tar.gz
Qt-2b098cd37d86bc7c843225412c90948affb8fef1.tar.bz2
Test imports with realistic paths (previously passed accidentally).
Fix failure when import path is ancestor dir of other import path.
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 0bedbeb..c49c464 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -1418,6 +1418,11 @@ struct QDeclarativeEnginePrivate::ImportedNamespace {
}
};
+static bool greaterThan(const QString &s1, const QString &s2)
+{
+ return s1 > s2;
+}
+
class QDeclarativeImportsPrivate {
public:
QDeclarativeImportsPrivate() : ref(1)
@@ -1495,6 +1500,8 @@ public:
// add fileImportPath last, this is *not* search order.
paths += QDeclarativeEnginePrivate::get(engine)->fileImportPath;
+ qSort(paths.begin(), paths.end(), greaterThan); // Ensure subdirs preceed their parents.
+
QString stableRelativePath = dir;
foreach( QString path, paths) {
if (dir.startsWith(path)) {
@@ -1545,11 +1552,11 @@ public:
paths += applicationDirPath;
paths += QDeclarativeEnginePrivate::get(engine)->environmentImportPath;
- #if (QT_VERSION >= QT_VERSION_CHECK(4,7,0))
+#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0))
QString builtinPath = QLibraryInfo::location(QLibraryInfo::ImportsPath);
- #else
+#else
QString builtinPath;
- #endif
+#endif
if (!builtinPath.isEmpty())
paths += builtinPath;