From ea1d729669fe960e079fbb73f1f7f36aa1c1bac8 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 12 Jan 2023 10:40:02 +0100 Subject: Utils: Move PathChooser::expandedDirectory() to its only user ... and simplify its use given the always empty base dir there. Change-Id: Ieeff7f31653db1512edc2cc448f80efc9bb7222e Reviewed-by: Reviewed-by: Christian Stenger --- src/libs/utils/pathchooser.cpp | 14 -------------- src/libs/utils/pathchooser.h | 3 --- src/plugins/projectexplorer/runconfigurationaspects.cpp | 5 ++++- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index 213bc467e5..05825220af 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -354,20 +354,6 @@ FilePath PathChooser::absoluteFilePath() const return d->m_baseDirectory.resolvePath(filePath()); } -// FIXME: try to remove again -QString PathChooser::expandedDirectory(const QString &input, const Environment &env, - const QString &baseDir) -{ - if (input.isEmpty()) - return input; - const QString path = QDir::cleanPath(env.expandVariables(input)); - if (path.isEmpty()) - return path; - if (!baseDir.isEmpty() && QFileInfo(path).isRelative()) - return QFileInfo(baseDir + '/' + path).absoluteFilePath(); - return path; -} - void PathChooser::setPath(const QString &path) { QTC_ASSERT(!d->m_callGuard.isLocked(), return); diff --git a/src/libs/utils/pathchooser.h b/src/libs/utils/pathchooser.h index a796aac079..2a3ee05610 100644 --- a/src/libs/utils/pathchooser.h +++ b/src/libs/utils/pathchooser.h @@ -73,9 +73,6 @@ public: FilePath rawFilePath() const; // The raw unexpanded input as FilePath. - static QString expandedDirectory(const QString &input, const Environment &env, - const QString &baseDir); - FilePath baseDirectory() const; void setBaseDirectory(const FilePath &base); diff --git a/src/plugins/projectexplorer/runconfigurationaspects.cpp b/src/plugins/projectexplorer/runconfigurationaspects.cpp index 69244107d3..c8f3836e46 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/runconfigurationaspects.cpp @@ -238,7 +238,10 @@ FilePath WorkingDirectoryAspect::workingDirectory() const QString workingDir = m_workingDirectory.path(); if (m_macroExpander) workingDir = m_macroExpander->expandProcessArgs(workingDir); - return m_workingDirectory.withNewPath(PathChooser::expandedDirectory(workingDir, env, QString())); + + QString res = workingDir.isEmpty() ? QString() : QDir::cleanPath(env.expandVariables(workingDir)); + + return m_workingDirectory.withNewPath(res); } FilePath WorkingDirectoryAspect::defaultWorkingDirectory() const -- cgit v1.2.1