Skip to content

Commit 86205ff

Browse files
committed
fix(rmdir): switch to another API for folder removal
current QDir::rmdir API does not provide an error message when failing to delete retuse FileSystem::remove that may just works with folders Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
1 parent ff3bf03 commit 86205ff

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/libsync/filesystem.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ bool FileSystem::removeRecursively(const QString &path, const std::function<void
304304
const auto parentFolderPath = fileInfo.dir().absolutePath();
305305
const auto parentPermissionsHandler = FileSystem::FilePermissionsRestore{parentFolderPath, FileSystem::FolderPermissions::ReadWrite};
306306
FileSystem::setFolderPermissions(path, FileSystem::FolderPermissions::ReadWrite);
307-
allRemoved = QDir().rmdir(path);
307+
auto folderDeleteError = QString{};
308+
allRemoved = FileSystem::remove(path, &folderDeleteError);
308309
qCInfo(lcFileSystem()) << "delete" << path;
309310
if (allRemoved) {
310311
if (onDeleted)
@@ -317,7 +318,7 @@ bool FileSystem::removeRecursively(const QString &path, const std::function<void
317318
if (onError) {
318319
onError(di.filePath(), false);
319320
}
320-
qCWarning(lcFileSystem) << "Error removing folder" << path;
321+
qCWarning(lcFileSystem) << "Error removing folder" << path << folderDeleteError;
321322
}
322323
}
323324
return allRemoved;

0 commit comments

Comments
 (0)