From 10807aed88c5f5fa3fa9c5c68c193f2b7cf980ad Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 9 Sep 2021 17:08:32 +0200 Subject: [PATCH] Utils: Introduce PathChoser::absoluteFilePath() As we have a valid context to resolve relative files here this is a good source for absolute files that don't depend on QFilePath::absolute{File,}Path or similar. Change-Id: Iaf592aa746023f80de517703e32e6b80a3d0fd7e Reviewed-by: David Schulz Reviewed-by: Artem Sokolovskii --- src/libs/utils/pathchooser.cpp | 5 +++++ src/libs/utils/pathchooser.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index 01e9c7d7109..e4a7ad5507e 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -357,6 +357,11 @@ FilePath PathChooser::filePath() const return d->expandedPath(rawFilePath().toString()); } +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) diff --git a/src/libs/utils/pathchooser.h b/src/libs/utils/pathchooser.h index 288d370bdaa..ddc68b227e5 100644 --- a/src/libs/utils/pathchooser.h +++ b/src/libs/utils/pathchooser.h @@ -90,7 +90,8 @@ public: bool isValid() const; QString errorMessage() const; - FilePath filePath() const; + FilePath filePath() const; // Close to what's in the line edit. + FilePath absoluteFilePath() const; // Relative paths resolved wrt the specified base dir. QString rawPath() const; // The raw unexpanded input. FilePath rawFilePath() const; // The raw unexpanded input as FilePath.