diff options
author | hjk <hjk@qt.io> | 2023-01-12 10:40:02 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2023-01-23 13:49:16 +0000 |
commit | ea1d729669fe960e079fbb73f1f7f36aa1c1bac8 (patch) | |
tree | 58f83f3e24bb3cc5b4c6120bb30661f9e96eb4a0 | |
parent | 156ef28d9013d17bec0ddd166eaa1119f8831ef4 (diff) | |
download | qt-creator-ea1d729669fe960e079fbb73f1f7f36aa1c1bac8.tar.gz |
Utils: Move PathChooser::expandedDirectory() to its only user
... and simplify its use given the always empty base dir there.
Change-Id: Ieeff7f31653db1512edc2cc448f80efc9bb7222e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r-- | src/libs/utils/pathchooser.cpp | 14 | ||||
-rw-r--r-- | src/libs/utils/pathchooser.h | 3 | ||||
-rw-r--r-- | 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 |