forked from qt-creator/qt-creator
QmlProjectManager: Fix for absolute import path problem
Task-number: QDS-10145 Change-Id: I11998b474a25351901ca0eb45716e1d3e309c572 Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -200,8 +200,8 @@ void QmlBuildSystem::refresh(RefreshOptions options)
|
||||
= modelManager->defaultProjectInfoForProject(project(),
|
||||
project()->files(Project::HiddenRccFolders));
|
||||
|
||||
for (const QString &searchPath : customImportPaths()) {
|
||||
projectInfo.importPaths.maybeInsert(projectDirectory().pathAppended(searchPath),
|
||||
for (const QString &importPath : absoluteImportPaths()) {
|
||||
projectInfo.importPaths.maybeInsert(Utils::FilePath::fromString(importPath),
|
||||
QmlJS::Dialect::Qml);
|
||||
}
|
||||
|
||||
@@ -649,6 +649,16 @@ QStringList QmlBuildSystem::importPaths() const
|
||||
return m_projectItem->importPaths();
|
||||
}
|
||||
|
||||
QStringList QmlBuildSystem::absoluteImportPaths()
|
||||
{
|
||||
return Utils::transform<QStringList>(m_projectItem->importPaths(), [&](const QString &importPath) {
|
||||
Utils::FilePath filePath = Utils::FilePath::fromString(importPath);
|
||||
if (!filePath.isAbsolutePath())
|
||||
return (projectDirectory() / importPath).toString();
|
||||
return projectDirectory().resolvePath(importPath).toString();
|
||||
});
|
||||
}
|
||||
|
||||
Utils::FilePaths QmlBuildSystem::files() const
|
||||
{
|
||||
return m_projectItem->files();
|
||||
|
||||
Reference in New Issue
Block a user