summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativeengine.cpp
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2010-03-30 12:34:00 (GMT)
committermae <qt-info@nokia.com>2010-03-30 12:35:07 (GMT)
commit1441db525dd0f5a3b2f45549cfa4173adac1a877 (patch)
tree90cd6142453d6d4e784fa0cc699fff4d7ca9b8d1 /src/declarative/qml/qdeclarativeengine.cpp
parentc6dbce5e54da4c33ae50fad9aab21457a9219f94 (diff)
downloadQt-1441db525dd0f5a3b2f45549cfa4173adac1a877.zip
Qt-1441db525dd0f5a3b2f45549cfa4173adac1a877.tar.gz
Qt-1441db525dd0f5a3b2f45549cfa4173adac1a877.tar.bz2
Fix qml plugin loading with specified path in qmldir
The fix makes it possible to specify an ABSOLUTE path as well, e.g.: plugin mimehunt C:\sys\bin
Diffstat (limited to 'src/declarative/qml/qdeclarativeengine.cpp')
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index abac086..bb742ee 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -1463,13 +1463,14 @@ public:
QDeclarativeDirComponents importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeEngine *engine) {
QFile file(absoluteFilePath);
- QString dir = QFileInfo(file).path();
QString filecontent;
if (file.open(QFile::ReadOnly)) {
filecontent = QString::fromUtf8(file.readAll());
if (qmlImportTrace())
qDebug() << "QDeclarativeEngine::add: loaded" << absoluteFilePath;
}
+ QDir dir = QFileInfo(file).dir();
+
QDeclarativeDirParser qmldirParser;
qmldirParser.setSource(filecontent);
qmldirParser.parse();
@@ -1479,9 +1480,13 @@ public:
foreach (const QDeclarativeDirParser::Plugin &plugin, qmldirParser.plugins()) {
- QDir pluginDir(dir + QDir::separator() + plugin.path);
- if (dir.startsWith(QLatin1Char(':')))
+
+ QDir pluginDir = dir.absoluteFilePath(plugin.path);
+
+ // hack for resources, should probably go away
+ if (absoluteFilePath.startsWith(QLatin1Char(':')))
pluginDir = QDir(QCoreApplication::applicationDirPath());
+
QString resolvedFilePath =
QDeclarativeEnginePrivate::get(engine)
->resolvePlugin(pluginDir,