diff options
author | mae <qt-info@nokia.com> | 2010-03-30 12:34:00 (GMT) |
---|---|---|
committer | mae <qt-info@nokia.com> | 2010-03-30 12:35:07 (GMT) |
commit | 1441db525dd0f5a3b2f45549cfa4173adac1a877 (patch) | |
tree | 90cd6142453d6d4e784fa0cc699fff4d7ca9b8d1 | |
parent | c6dbce5e54da4c33ae50fad9aab21457a9219f94 (diff) | |
download | Qt-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
-rw-r--r-- | src/declarative/qml/qdeclarativeengine.cpp | 11 |
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, |