diff options
| author | hjk <hjk@qt.io> | 2022-12-13 12:58:35 +0100 |
|---|---|---|
| committer | hjk <hjk@qt.io> | 2022-12-19 14:00:39 +0000 |
| commit | 6a4123a96ffddd950d94268b49c47923a63f29cc (patch) | |
| tree | cb19c54df5ec1dea9dd4787caba9b3aa6e930120 /src/plugins/qmlprojectmanager/qmlproject.cpp | |
| parent | 5c7c102f3ef232431ce5fa2672637a5ea903da7f (diff) | |
| download | qt-creator-6a4123a96ffddd950d94268b49c47923a63f29cc.tar.gz | |
QmlProjectManager: Even more FilePath use
Change-Id: I4990b9171598d7f277f8e8e5a2b3e0fb1a3375d0
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Diffstat (limited to 'src/plugins/qmlprojectmanager/qmlproject.cpp')
| -rw-r--r-- | src/plugins/qmlprojectmanager/qmlproject.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index cbbb13af42..e3508fea80 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -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 |
