QmlProject: Do not allow "." in importPaths

Adding the root folder to importPaths can create all kind of issues
and is not supported.

Change-Id: I03fe8924f08b11704fc472ed9cfa0b765ab7cf06
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Thomas Hartmann
2022-02-04 16:10:32 +01:00
parent 0a9acad18c
commit 4fa399fbcb

View File

@@ -92,8 +92,11 @@ QmlProjectItem *QmlProjectFileFormat::parseProjectFile(const Utils::FilePath &fi
projectItem->setMainFile(mainFileProperty.value.toString()); projectItem->setMainFile(mainFileProperty.value.toString());
const auto importPathsProperty = rootNode->property(QLatin1String("importPaths")); const auto importPathsProperty = rootNode->property(QLatin1String("importPaths"));
if (importPathsProperty.isValid()) if (importPathsProperty.isValid()) {
projectItem->setImportPaths(importPathsProperty.value.toStringList()); QStringList list = importPathsProperty.value.toStringList();
list.removeAll(".");
projectItem->setImportPaths(list);
}
const auto fileSelectorsProperty = rootNode->property(QLatin1String("fileSelectors")); const auto fileSelectorsProperty = rootNode->property(QLatin1String("fileSelectors"));
if (fileSelectorsProperty.isValid()) if (fileSelectorsProperty.isValid())