QmlProjectManager: Even more FilePath use

Change-Id: I4990b9171598d7f277f8e8e5a2b3e0fb1a3375d0
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2022-12-13 12:58:35 +01:00
parent 5c7c102f3e
commit 6a4123a96f
5 changed files with 43 additions and 32 deletions

View File

@@ -214,9 +214,9 @@ void QmlBuildSystem::parseProject(RefreshOptions options)
}
}
if (m_projectItem) {
m_projectItem->setSourceDirectory(canonicalProjectDir().toString());
m_projectItem->setSourceDirectory(canonicalProjectDir());
if (m_projectItem->targetDirectory().isEmpty())
m_projectItem->setTargetDirectory(canonicalProjectDir().toString());
m_projectItem->setTargetDirectory(canonicalProjectDir());
if (auto modelManager = QmlJS::ModelManagerInterface::instance()) {
QStringList files = m_projectItem->files();
@@ -415,23 +415,22 @@ void QmlBuildSystem::setMainFile(const QString &mainFilePath)
m_projectItem->setMainFile(mainFilePath);
}
Utils::FilePath QmlBuildSystem::targetDirectory() const
FilePath QmlBuildSystem::targetDirectory() const
{
if (DeviceTypeKitAspect::deviceTypeId(kit())
== ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
return canonicalProjectDir();
return m_projectItem ? Utils::FilePath::fromString(m_projectItem->targetDirectory())
: Utils::FilePath();
return m_projectItem ? m_projectItem->targetDirectory() : FilePath();
}
Utils::FilePath QmlBuildSystem::targetFile(const Utils::FilePath &sourceFile) const
FilePath QmlBuildSystem::targetFile(const FilePath &sourceFile) const
{
const QDir sourceDir(m_projectItem ? m_projectItem->sourceDirectory()
: canonicalProjectDir().toString());
const QDir targetDir(targetDirectory().toString());
const QString relative = sourceDir.relativeFilePath(sourceFile.toString());
return Utils::FilePath::fromString(QDir::cleanPath(targetDir.absoluteFilePath(relative)));
const FilePath sourceDir = m_projectItem ? m_projectItem->sourceDirectory()
: canonicalProjectDir();
const FilePath targetDir = targetDirectory();
const FilePath relative = sourceFile.relativePathFrom(sourceDir);
return targetDir.resolvePath(relative);
}
Utils::EnvironmentItems QmlBuildSystem::environment() const