aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlimport.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-03-01 10:06:41 +0100
committerUlf Hermann <ulf.hermann@qt.io>2021-03-01 19:57:02 +0100
commitb0fa92ddb6c7c2162571452beec680e0bdfc687c (patch)
tree44986f6725e18d658f19ea7a594301af1a286940 /src/qml/qml/qqmlimport.cpp
parent75fc3d1cd4347ae6226a2baa99b861de65b62a5e (diff)
QQmlImport: Don't cache localDirectoryPath
It's only used in one place. We can just calculate it there. Change-Id: If9d1c7e6a6fc012eeba8fff9ce24d3c4b149c914 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlimport.cpp')
-rw-r--r--src/qml/qml/qqmlimport.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index 6540c1f301..1ac2057b98 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -657,7 +657,6 @@ bool QQmlImportInstance::setQmldirContent(const QString &resolvedUrl,
{
Q_ASSERT(resolvedUrl.endsWith(Slash));
url = resolvedUrl;
- localDirectoryPath = QQmlFile::urlToLocalFileOrQrc(url);
qmlDirComponents = qmldir.components();
@@ -834,7 +833,12 @@ bool QQmlImportInstance::resolveType(QQmlTypeLoader *typeLoader, const QHashedSt
*type_return = returnType;
return returnType.isValid();
}
- } else if (!isLibrary && !localDirectoryPath.isEmpty()) {
+ } else if (!isLibrary) {
+ // the base path of the import if it's a local file
+ const QString localDirectoryPath = QQmlFile::urlToLocalFileOrQrc(url);
+ if (localDirectoryPath.isEmpty())
+ return false;
+
QString qmlUrl;
bool exists = false;
@@ -1570,7 +1574,6 @@ QQmlImportInstance *QQmlImportsPrivate::addImportToNamespace(
QQmlImportInstance *import = new QQmlImportInstance;
import->uri = uri;
import->url = url;
- import->localDirectoryPath = QQmlFile::urlToLocalFileOrQrc(url);
import->version = version;
import->isLibrary = (type == QV4::CompiledData::Import::ImportLibrary);
if (flags & QQmlImports::ImportImplicit) {