ProjectExplorer: Simplify WorkingDirectoryAspect

expandProcessArgs has some very specific rules that are not necessary
for the build directory, so we use expand(FilePath) instead.

Since Environment::expandVariables(FilePath) cleans the path we
do not have to call QDir::cleanPath ourselves.

Change-Id: Ia08a4abafa00c33ebbc283523051e987c58fa983
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-10-18 12:51:15 +02:00
parent 49e268d649
commit ca38a7a2d3

View File

@@ -248,13 +248,10 @@ FilePath WorkingDirectoryAspect::workingDirectory() const
{
const Environment env = m_envAspect ? m_envAspect->environment()
: Environment::systemEnvironment();
QString workingDir = m_workingDirectory.path();
if (auto expander = macroExpander())
workingDir = expander->expandProcessArgs(workingDir);
QString res = workingDir.isEmpty() ? QString() : QDir::cleanPath(env.expandVariables(workingDir));
return m_workingDirectory.withNewPath(res);
const FilePath workingDir = macroExpander()->expand(m_workingDirectory);
if (m_envAspect)
return env.expandVariables(workingDir);
return workingDir;
}
FilePath WorkingDirectoryAspect::defaultWorkingDirectory() const