From 4f7d24acb6f618ac3b2560e3746bf361848105f5 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Mon, 29 Oct 2018 10:39:31 +0100 Subject: [PATCH] QmnlDesigner: Avoid paths starting with '//' Windows these are interpreted as network hosts and the timeout when resolving those is way too long. Task-number: QTCREATORBUG-21372 Change-Id: Ib796473158cec620de26592bf628ab18d676153d Reviewed-by: Tim Jenssen --- .../propertyeditorqmlbackend.cpp | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp index b0bebdcd5cb..751f444e660 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp @@ -554,21 +554,25 @@ QString PropertyEditorQmlBackend::locateQmlFile(const NodeMetaInfo &info, const const QString withoutDirWithVersion = relativePathWithVersion.split(QStringLiteral("/")).constLast(); - const QStringList possiblePaths = { - importDir.absoluteFilePath(relativePathWithVersion), - //Since we are in a subfolder of the import we do not require the directory - importDir.absoluteFilePath(withoutDirWithVersion), + QStringList possiblePaths = { fileSystemDir.absoluteFilePath(relativePathWithVersion), resourcesDir.absoluteFilePath(relativePathWithVersion), - - importDir.absoluteFilePath(relativePath), - //Since we are in a subfolder of the import we do not require the directory - importDir.absoluteFilePath(withoutDir), fileSystemDir.absoluteFilePath(relativePath), resourcesDir.absoluteFilePath(relativePath) }; + + if (!importDir.isEmpty()) + possiblePaths.append({ + importDir.absoluteFilePath(relativePathWithVersion), + //Since we are in a subfolder of the import we do not require the directory + importDir.absoluteFilePath(withoutDirWithVersion), + importDir.absoluteFilePath(relativePath), + //Since we are in a subfolder of the import we do not require the directory + importDir.absoluteFilePath(withoutDir), + }); + return Utils::findOrDefault(possiblePaths, [](const QString &possibleFilePath) { - return QFile::exists(possibleFilePath); + return QFileInfo::exists(possibleFilePath); }); }