From b97f7eb84cb76f435f2b66d20a8c6a9fbae1f7d4 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Fri, 4 Apr 2025 16:37:11 +0200 Subject: [PATCH] when deleting a folder starts by making it read-write permissions Signed-off-by: Matthieu Gallien --- src/libsync/filesystem.cpp | 2 ++ src/libsync/propagatorjobs.cpp | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libsync/filesystem.cpp b/src/libsync/filesystem.cpp index ecf950fe34..5b719bd8be 100644 --- a/src/libsync/filesystem.cpp +++ b/src/libsync/filesystem.cpp @@ -259,6 +259,8 @@ qint64 FileSystem::getSize(const QString &filename) // Code inspired from Qt5's QDir::removeRecursively bool FileSystem::removeRecursively(const QString &path, const std::function &onDeleted, QStringList *errors) { + FileSystem::setFolderPermissions(path, FileSystem::FolderPermissions::ReadWrite); + bool allRemoved = true; QDirIterator di(path, QDir::AllEntries | QDir::Hidden | QDir::System | QDir::NoDotAndDotDot); diff --git a/src/libsync/propagatorjobs.cpp b/src/libsync/propagatorjobs.cpp index b1d85e1989..a443d84547 100644 --- a/src/libsync/propagatorjobs.cpp +++ b/src/libsync/propagatorjobs.cpp @@ -63,7 +63,6 @@ bool PropagateLocalRemove::removeRecursively(const QString &path) const auto fileInfo = QFileInfo{absolute}; const auto parentFolderPath = fileInfo.dir().absolutePath(); const auto parentPermissionsHandler = FileSystem::FilePermissionsRestore{parentFolderPath, FileSystem::FolderPermissions::ReadWrite}; - FileSystem::setFolderPermissions(absolute, FileSystem::FolderPermissions::ReadWrite); bool success = FileSystem::removeRecursively( absolute, [&deleted](const QString &path, bool isDir) {