Browse Source

In system::removeRecursively(), make all sub-entries writable before attempting to recursively remove.

tags/v2.3.0
Andrew Belt 1 year ago
parent
commit
e62eeccb3d
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      src/system.cpp

+ 8
- 2
src/system.cpp View File

@@ -185,9 +185,15 @@ bool remove(const std::string& path) {
} }




int removeRecursively(const std::string& path) {
int removeRecursively(const std::string& pathStr) {
fs::path path = fs::u8path(pathStr);
try { try {
return fs::remove_all(fs::u8path(path));
// Make all entries writable before attempting to remove
for (auto& entry : fs::recursive_directory_iterator(path)) {
fs::permissions(entry.path(), fs::perms::owner_write, fs::perm_options::add);
}

return fs::remove_all(path);
} }
catch (fs::filesystem_error& e) { catch (fs::filesystem_error& e) {
return 0; return 0;


Loading…
Cancel
Save