Utils: add absoluteFilePath convenience function to FilePath

Change-Id: I870c3e8fce908d3c5830d2716b525cb12b701503
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2021-05-18 12:43:48 +02:00
parent cf6d9b587e
commit 7020d54a0a
2 changed files with 8 additions and 0 deletions

View File

@@ -878,6 +878,13 @@ FilePath FilePath::absolutePath() const
return result; return result;
} }
FilePath FilePath::absoluteFilePath() const
{
FilePath result = *this;
result.m_data = QFileInfo(m_data).absoluteFilePath();
return result;
}
/// Constructs an absolute FilePath from this path which /// Constructs an absolute FilePath from this path which
/// is interpreted as being relative to \a anchor. /// is interpreted as being relative to \a anchor.
FilePath FilePath::absoluteFromRelativePath(const FilePath &anchor) const FilePath FilePath::absoluteFromRelativePath(const FilePath &anchor) const

View File

@@ -119,6 +119,7 @@ public:
FilePath parentDir() const; FilePath parentDir() const;
FilePath absolutePath() const; FilePath absolutePath() const;
FilePath absoluteFilePath() const;
FilePath absoluteFromRelativePath(const FilePath &anchor) const; FilePath absoluteFromRelativePath(const FilePath &anchor) const;
bool operator==(const FilePath &other) const; bool operator==(const FilePath &other) const;