forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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);
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user