qmljsmodelmanager: Add additional directories to find qmltypes

This works around the issue that we only looked for qmltypes in the
directory the binary ends up being stored in. This did not work
for macOS and Windows as those are stored in subdirectories due
the platform specific ways binaries are stored there.

Now we also look in the directory where the qmltypes should be located
on these platforms.

Task-number: QTCREATORBUG-24987
Change-Id: I23d46e68f8fad0b4e2e8a01fc7c41360f1e6961e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Maximilian Goldstein
2021-12-06 17:13:19 +01:00
committed by Fawzi Mohamed
parent 655e64b2da
commit 3d47a0ef09

View File

@@ -142,6 +142,17 @@ ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfoForProject(
if (target.targetFilePath.isEmpty())
continue;
projectInfo.applicationDirectories.append(target.targetFilePath.parentDir().toString());
#if defined(Q_OS_WIN)
// On Windows systems QML type information is located one directory higher as we build
// in dedicated "debug" and "release" directories
projectInfo.applicationDirectories.append(
target.targetFilePath.parentDir().parentDir().toString());
#elif defined(Q_OS_MACOS)
// On macOS this is not the case but the targetFilePath is within the bundle so we have
// to go up through all three additional directories (BundleName.app/Contents/MacOS)
projectInfo.applicationDirectories.append(
target.targetFilePath.parentDir().parentDir().parentDir().parentDir().toString());
#endif
}
}
if (qtVersion && qtVersion->isValid()) {