ProjectExplorer: Use real FilePaths for build directories

Even though build directories are later usually accessed "locally in
the context of a build device" even in true remote" setups it is easier
to reason about them if they follow the convention, especially as they
are used to derive other paths that might be used to access items in
a host context.

Change-Id: Ib831bdd1f81981ef96323dcb8d1cd21c31347c19
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2021-06-16 18:58:01 +02:00
parent e5dd24322f
commit 93d7821eae

View File

@@ -240,7 +240,11 @@ FilePath BuildConfiguration::buildDirectory() const
{ {
QString path = environment().expandVariables(d->m_buildDirectoryAspect->value().trimmed()); QString path = environment().expandVariables(d->m_buildDirectoryAspect->value().trimmed());
path = QDir::cleanPath(macroExpander()->expand(path)); path = QDir::cleanPath(macroExpander()->expand(path));
return FilePath::fromString(QDir::cleanPath(QDir(target()->project()->projectDirectory().toString()).absoluteFilePath(path)));
const FilePath projectDir = target()->project()->projectDirectory();
const FilePath buildDir = projectDir.absoluteFilePath(FilePath::fromString(path));
return mapFromBuildDeviceToGlobalPath(buildDir);
} }
FilePath BuildConfiguration::rawBuildDirectory() const FilePath BuildConfiguration::rawBuildDirectory() const
@@ -296,8 +300,7 @@ MacroExpander *BuildConfiguration::macroExpander() const
bool BuildConfiguration::createBuildDirectory() bool BuildConfiguration::createBuildDirectory()
{ {
QDir dir; const bool result = buildDirectory().ensureWritableDir();
const auto result = dir.mkpath(buildDirectory().toString());
buildDirectoryAspect()->validateInput(); buildDirectoryAspect()->validateInput();
return result; return result;
} }