From 3904e604f453b43b2a0e45a882283e26a27eaa18 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Thu, 28 Apr 2011 12:22:30 +0200 Subject: [PATCH] qmlplugindump: Fix --path usage with drive letters on Windows. Since we can't import by such a path, we instead use a "." import and set the uri of the component to the correct path. Mirrors a change to qmldump in qt-creator/0c8b4e38fab1862e3427aac7e7db68623bc7f174 Reviewed-by: Thomas Hartmann --- tools/qmlplugindump/main.cpp | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index 848b091..c2d2681 100644 --- a/tools/qmlplugindump/main.cpp +++ b/tools/qmlplugindump/main.cpp @@ -65,6 +65,8 @@ #include #endif +QString pluginImportPath; + void collectReachableMetaObjects(const QMetaObject *meta, QSet *metas) { if (! meta || metas->contains(meta)) @@ -194,7 +196,7 @@ QSet collectReachableMetaObjects(const QString &importCode, code += " {}\n"; QDeclarativeComponent c(engine); - c.setData(code, QUrl("typeinstance")); + c.setData(code, QUrl::fromLocalFile(pluginImportPath + "/typeinstance.qml")); QObject *object = c.create(); if (object) @@ -451,7 +453,6 @@ int main(int argc, char *argv[]) QString pluginImportUri; QString pluginImportVersion; - QString pluginImportPath; bool relocatable = true; bool pathImport = false; if (args.size() >= 3) { @@ -488,7 +489,7 @@ int main(int argc, char *argv[]) qWarning() << "Incorrect number of positional arguments"; return EXIT_INVALIDARGUMENTS; } - pluginImportPath = positionalArgs[1]; + pluginImportPath = QDir::fromNativeSeparators(positionalArgs[1]); if (positionalArgs.size() == 3) pluginImportVersion = positionalArgs[2]; } @@ -514,7 +515,7 @@ int main(int argc, char *argv[]) importCode += QString("import %0 %1\n").arg(pluginImportUri, pluginImportVersion).toAscii(); } else { // pluginImportVersion can be empty - importCode += QString("import \"%1\" %2\n").arg(pluginImportPath, pluginImportVersion).toAscii(); + importCode += QString("import \".\" %2\n").arg(pluginImportVersion).toAscii(); } // create a component with these imports to make sure the imports are valid @@ -524,7 +525,7 @@ int main(int argc, char *argv[]) code += "QtObject {}"; QDeclarativeComponent c(engine); - c.setData(code, QUrl("typelist")); + c.setData(code, QUrl::fromLocalFile(pluginImportPath + "/typelist.qml")); c.create(); if (!c.errors().isEmpty()) { foreach (const QDeclarativeError &error, c.errors()) -- 1.7.2.5