diff --git a/src/libs/utils/filepath.cpp b/src/libs/utils/filepath.cpp index e3ae97267dd..796f887cc23 100644 --- a/src/libs/utils/filepath.cpp +++ b/src/libs/utils/filepath.cpp @@ -455,30 +455,6 @@ void FilePath::setParts(const QStringView scheme, const QStringView host, QStrin m_pathLen = path.size(); } -/*! - Returns a bool indicating whether a file or directory with this FilePath exists. -*/ -bool FilePath::exists() const -{ - return fileAccess()->exists(*this); -} - -/*! - Returns a bool indicating whether this is a writable directory. -*/ -bool FilePath::isWritableDir() const -{ - return fileAccess()->isWritableDirectory(*this); -} - -/*! - Returns a bool indicating whether this is a writable file. -*/ -bool FilePath::isWritableFile() const -{ - return fileAccess()->isWritableFile(*this); -} - /*! \brief Re-uses or creates a directory in this location. @@ -496,14 +472,6 @@ bool FilePath::ensureExistingFile() const return fileAccess()->ensureExistingFile(*this); } -/*! - Returns a bool indicating whether this is an executable file. -*/ -bool FilePath::isExecutableFile() const -{ - return fileAccess()->isExecutableFile(*this); -} - /*! Returns a bool indicating on whether a process with this FilePath's native path is likely to start. @@ -551,31 +519,6 @@ expected_str FilePath::createTempFile() const return fileAccess()->createTempFile(*this); } -bool FilePath::isReadableFile() const -{ - return fileAccess()->isReadableFile(*this); -} - -bool FilePath::isReadableDir() const -{ - return fileAccess()->isReadableDirectory(*this); -} - -bool FilePath::isFile() const -{ - return fileAccess()->isFile(*this); -} - -bool FilePath::isDir() const -{ - return fileAccess()->isDirectory(*this); -} - -bool FilePath::isSymLink() const -{ - return fileAccess()->isSymLink(*this); -} - bool FilePath::hasHardLinks() const { return fileAccess()->hasHardLinks(*this); @@ -1217,6 +1160,100 @@ bool FilePath::hasFileAccess() const return access && access.value(); } +/*! + Returns a bool indicating whether a file or directory with this FilePath exists. +*/ +bool FilePath::exists() const +{ + const expected_str access = getFileAccess(*this); + if (!access) + return false; + + return (*access)->exists(*this); +} + +/*! + Returns a bool indicating whether this is an executable file. +*/ +bool FilePath::isExecutableFile() const +{ + const expected_str access = getFileAccess(*this); + if (!access) + return false; + + return (*access)->isExecutableFile(*this); +} + +/*! + Returns a bool indicating whether this is a writable directory. +*/ +bool FilePath::isWritableDir() const +{ + const expected_str access = getFileAccess(*this); + if (!access) + return false; + + return (*access)->isWritableDirectory(*this); +} + +/*! + Returns a bool indicating whether this is a writable file. +*/ +bool FilePath::isWritableFile() const +{ + const expected_str access = getFileAccess(*this); + if (!access) + return false; + + return (*access)->isWritableFile(*this); +} + + +bool FilePath::isReadableFile() const +{ + const expected_str access = getFileAccess(*this); + if (!access) + return false; + + return (*access)->isReadableFile(*this); +} + +bool FilePath::isReadableDir() const +{ + const expected_str access = getFileAccess(*this); + if (!access) + return false; + + return (*access)->isReadableDirectory(*this); +} + +bool FilePath::isFile() const +{ + const expected_str access = getFileAccess(*this); + if (!access) + return false; + + return (*access)->isFile(*this); +} + +bool FilePath::isDir() const +{ + const expected_str access = getFileAccess(*this); + if (!access) + return false; + + return (*access)->isDirectory(*this); +} + +bool FilePath::isSymLink() const +{ + const expected_str access = getFileAccess(*this); + if (!access) + return false; + + return (*access)->isSymLink(*this); +} + /*! Constructs a FilePath from \a filepath. The \a defaultExtension is appended to \a filepath if that does not have an extension already.