diff options
author | hjk <[email protected]> | 2021-07-01 08:59:32 +0200 |
---|---|---|
committer | hjk <[email protected]> | 2021-07-02 04:57:24 +0000 |
commit | 92904480f0a8d696b3f0dcd46353accb64a44cee (patch) | |
tree | 7702a16029e79ee572beabc5ed130f06742b3184 /src/libs/utils/fileutils.cpp | |
parent | 8ed5836746221a07c58e8eaa0c40aecf0e587a10 (diff) |
Utils: Merge FileUtils::removeRecursively() into FilePath
This simplify the interface by removing a possibly wrong choice
ensures it works also on remote paths.
Change-Id: I01e198958900a91b99dcf2dbb491a593485493ba
Reviewed-by: David Schulz <[email protected]>
Diffstat (limited to 'src/libs/utils/fileutils.cpp')
-rw-r--r-- | src/libs/utils/fileutils.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index 1f32637cbf2..374f495dfd2 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -76,14 +76,7 @@ static DeviceFileHooks s_deviceHooks; */ -/*! - Removes the directory \a filePath and its subdirectories recursively. - - \note The \a error parameter is optional. - - Returns whether the operation succeeded. -*/ -bool FileUtils::removeRecursively(const FilePath &filePath, QString *error) +static bool removeRecursivelyLocal(const FilePath &filePath, QString *error) { QTC_ASSERT(!filePath.needsDevice(), return false); QFileInfo fileInfo = filePath.toFileInfo(); @@ -111,7 +104,7 @@ bool FileUtils::removeRecursively(const FilePath &filePath, QString *error) const QStringList fileNames = dir.entryList( QDir::Files | QDir::Hidden | QDir::System | QDir::Dirs | QDir::NoDotAndDotDot); for (const QString &fileName : fileNames) { - if (!removeRecursively(filePath / fileName, error)) + if (!removeRecursivelyLocal(filePath / fileName, error)) return false; } if (!QDir::root().rmdir(dir.path())) { @@ -1443,13 +1436,20 @@ bool FilePath::removeFile() const return QFile::remove(path()); } -bool FilePath::removeRecursively() const +/*! + Removes the directory this filePath refers too and its subdirectories recursively. + + \note The \a error parameter is optional. + + Returns whether the operation succeeded. +*/ +bool FilePath::removeRecursively(QString *error) const { if (needsDevice()) { QTC_ASSERT(s_deviceHooks.removeRecursively, return false); return s_deviceHooks.removeRecursively(*this); } - return FileUtils::removeRecursively(*this); + return removeRecursivelyLocal(*this, error); } bool FilePath::copyFile(const FilePath &target) const |