From 1441db525dd0f5a3b2f45549cfa4173adac1a877 Mon Sep 17 00:00:00 2001 From: mae Date: Tue, 30 Mar 2010 14:34:00 +0200 Subject: 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 --- src/declarative/qml/qdeclarativeengine.cpp | 11 ++++++++--- 1 file 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, -- cgit v0.12