forked from qt-creator/qt-creator
qmljsinterpreter: Fix directory imports not being found in selector paths
Previously qml files in selector paths would not properly locate directory imports, now when an import in a selector path fails we try to go up to the next non-selector directory and look for the imported directory there. Fixes: QTCREATORBUG-25127 Change-Id: Ib9b364981b49068637aa97d6f75abf7f1f5878cc Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -2258,6 +2258,14 @@ ImportInfo ImportInfo::pathImport(const QString &docPath, const QString &path,
|
|||||||
? ImportType::QrcDirectory
|
? ImportType::QrcDirectory
|
||||||
: ImportType::QrcFile;
|
: ImportType::QrcFile;
|
||||||
} else {
|
} else {
|
||||||
|
QDir dir(docPath);
|
||||||
|
while (dir.dirName().startsWith("+"))
|
||||||
|
dir.cdUp();
|
||||||
|
|
||||||
|
const QString docPathStripped = dir.absolutePath();
|
||||||
|
if (docPathStripped != docPath)
|
||||||
|
return pathImport(docPathStripped, path, version, as, ast);
|
||||||
|
|
||||||
info.m_type = ImportType::UnknownFile;
|
info.m_type = ImportType::UnknownFile;
|
||||||
}
|
}
|
||||||
info.m_version = version;
|
info.m_version = version;
|
||||||
|
Reference in New Issue
Block a user