summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2016-12-12 10:48:25 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-01-02 08:14:46 +0000
commitcf0014e6aab225fd3dda4fed570baa384fb6df49 (patch)
treec760ac43d5e95b3e2d489f5ef6bc4a30693c0ed8
parent1ea5035ad0f663baa3bbc9880a8dd3d4473803e9 (diff)
downloadqttools-cf0014e6aab225fd3dda4fed570baa384fb6df49.tar.gz
windeployqt: Use relative path output by qmlimportscanner
Remove logic to strip version number off QML paths for determining the target directory. Task-number: QTBUG-57494 Task-number: QTBUG-52556 Change-Id: I605d8d2a27be20b779aa94feacd7bc3411237ddf Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
-rw-r--r--src/windeployqt/qmlutils.cpp35
-rw-r--r--src/windeployqt/qmlutils.h2
2 files changed, 8 insertions, 29 deletions
diff --git a/src/windeployqt/qmlutils.cpp b/src/windeployqt/qmlutils.cpp
index d3f706610..eaf36a384 100644
--- a/src/windeployqt/qmlutils.cpp
+++ b/src/windeployqt/qmlutils.cpp
@@ -39,38 +39,15 @@
QT_BEGIN_NAMESPACE
-// Return the relative install path, that is, for example for
-// module "QtQuick.Controls.Styles" in "path/qtbase/qml/QtQuick/Controls/Styles.3"
-// --> "QtQuick/Controls" suitable for updateFile() (cp -r semantics).
-QString QmlImportScanResult::Module::relativeInstallPath() const
-{
- const QChar dot = QLatin1Char('.');
- const QChar slash = QLatin1Char('/');
-
- // Find relative path by module name.
- if (!name.contains(dot))
- return QString(); // "QtQuick.2" -> flat folder.
- QString result = sourcePath;
- QString pathComponent = name;
- pathComponent.replace(dot, slash);
- const int pos = result.lastIndexOf(pathComponent);
- if (pos < 0)
- return QString();
- result.remove(0, pos);
- // return base name.
- const int lastSlash = result.lastIndexOf(slash);
- if (lastSlash >= 0)
- result.truncate(lastSlash);
- return result;
-}
-
+// Return install path (cp -r semantics)
QString QmlImportScanResult::Module::installPath(const QString &root) const
{
QString result = root;
- const QString relPath = relativeInstallPath();
- if (!relPath.isEmpty())
+ const int lastSlashPos = relativePath.lastIndexOf(QLatin1Char('/'));
+ if (lastSlashPos != -1) {
result += QLatin1Char('/');
- result += relPath;
+ result += relativePath.left(lastSlashPos);
+ }
return result;
}
@@ -148,6 +125,7 @@ QmlImportScanResult runQmlImportScanner(const QString &directory, const QString
module.name = object.value(QStringLiteral("name")).toString();
module.className = object.value(QStringLiteral("classname")).toString();
module.sourcePath = path;
+ module.relativePath = object.value(QStringLiteral("relativePath")).toString();
result.modules.append(module);
findFileRecursion(QDir(path), Platform(platform), debugMatchMode, &result.plugins);
// QTBUG-48424, QTBUG-45977: In release mode, qmlimportscanner does not report
@@ -161,6 +139,7 @@ QmlImportScanResult runQmlImportScanner(const QString &directory, const QString
privateWidgetsModule.name = QStringLiteral("QtQuick.PrivateWidgets");
privateWidgetsModule.className = QStringLiteral("QtQuick2PrivateWidgetsPlugin");
privateWidgetsModule.sourcePath = QFileInfo(path).absolutePath() + QStringLiteral("/PrivateWidgets");
+ privateWidgetsModule.relativePath = QStringLiteral("QtQuick/PrivateWidgets");
result.modules.append(privateWidgetsModule);
findFileRecursion(QDir(privateWidgetsModule.sourcePath), Platform(platform), debugMatchMode, &result.plugins);
}
diff --git a/src/windeployqt/qmlutils.h b/src/windeployqt/qmlutils.h
index 2fab3d0b3..5e1ddc619 100644
--- a/src/windeployqt/qmlutils.h
+++ b/src/windeployqt/qmlutils.h
@@ -39,12 +39,12 @@ QString findQmlDirectory(int platform, const QString &startDirectoryName);
struct QmlImportScanResult {
struct Module {
- QString relativeInstallPath() const;
QString installPath(const QString &root) const;
QString name;
QString className;
QString sourcePath;
+ QString relativePath;
};
QmlImportScanResult() : ok(false) {}