summaryrefslogtreecommitdiff
path: root/src/libs/qmljs/qmljsplugindumper.cpp
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2020-03-26 12:17:03 +0100
committerMaximilian Goldstein <max.goldstein@qt.io>2020-03-27 08:17:07 +0000
commit2392f29a59fd96cbec367a37174b58fbb8f22888 (patch)
tree772a0f33102ad3fc0cd084636743d1bdbc431322 /src/libs/qmljs/qmljsplugindumper.cpp
parentb9fb5b65f68725f849e447f3a1e742cb9094b07d (diff)
downloadqt-creator-2392f29a59fd96cbec367a37174b58fbb8f22888.tar.gz
qmljs: Do not use app.qmltypes and lib.qmltypes anymore
Task-number: QTBUG-82710 Change-Id: I876ec2b8e2b668a239248511b0fbd58389098de6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/libs/qmljs/qmljsplugindumper.cpp')
-rw-r--r--src/libs/qmljs/qmljsplugindumper.cpp25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/libs/qmljs/qmljsplugindumper.cpp b/src/libs/qmljs/qmljsplugindumper.cpp
index d74b4663fa..7ba665dc94 100644
--- a/src/libs/qmljs/qmljsplugindumper.cpp
+++ b/src/libs/qmljs/qmljsplugindumper.cpp
@@ -36,17 +36,12 @@
#include <utils/hostosinfo.h>
#include <QDir>
+#include <QDirIterator>
#include <QRegularExpression>
using namespace LanguageUtils;
using namespace QmlJS;
-static const QStringList qmltypesFileNames = {
- QLatin1String("plugins.qmltypes"),
- QLatin1String("app.qmltypes"),
- QLatin1String("lib.qmltypes")
-};
-
PluginDumper::PluginDumper(ModelManagerInterface *modelManager)
: QObject(modelManager)
, m_modelManager(modelManager)
@@ -152,9 +147,12 @@ void PluginDumper::onLoadPluginTypes(const QString &libraryPath, const QString &
plugin.importVersion = importVersion;
// add default qmltypes file if it exists
- for (const QString &qmltypesFileName : qmltypesFileNames) {
- const QString defaultQmltypesPath = makeAbsolute(qmltypesFileName, canonicalLibraryPath);
- if (!plugin.typeInfoPaths.contains(defaultQmltypesPath) && QFile::exists(defaultQmltypesPath))
+ QDirIterator it(canonicalLibraryPath, QStringList { "*.qmltypes" }, QDir::Files);
+
+ while (it.hasNext()) {
+ const QString defaultQmltypesPath = makeAbsolute(it.next(), canonicalLibraryPath);
+
+ if (!plugin.typeInfoPaths.contains(defaultQmltypesPath))
plugin.typeInfoPaths += defaultQmltypesPath;
}
@@ -405,11 +403,10 @@ QString PluginDumper::buildQmltypesPath(const QString &name) const
if (path.isEmpty())
return QString();
- for (const QString &qmltypesFileName : qmltypesFileNames) {
- const QString filename = path + QLatin1Char('/') + qmltypesFileName;
- if (QFile::exists(filename))
- return filename;
- }
+ QDirIterator it(path, QStringList { "*.qmltypes" }, QDir::Files);
+
+ if (it.hasNext())
+ return it.next();
return QString();
}