From 78bd902b9f770dee9b4d41f03c289574e6b59151 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Sat, 18 Aug 2018 12:00:06 +0300 Subject: [PATCH] Really delete things in fs::RecursiveDelete (#7433) * Really delete things in fs::RecursiveDelete --- src/filesys.cpp | 59 +++++++++++++++++++------------------------------ 1 file changed, 23 insertions(+), 36 deletions(-) diff --git a/src/filesys.cpp b/src/filesys.cpp index f961dedc6..be61ba430 100644 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -125,45 +125,32 @@ bool IsDirDelimiter(char c) bool RecursiveDelete(const std::string &path) { - infostream<<"Recursively deleting \""< content = GetDirListing(path); + for (const DirListNode &n: content) { + std::string fullpath = path + DIR_DELIM + n.name; + if (!RecursiveDelete(fullpath)) { + errorstream << "RecursiveDelete: Failed to recurse to " + << fullpath << std::endl; return false; } } - else - { - infostream<<"RecursiveDelete: Deleting content of directory " - < content = GetDirListing(path); - for(size_t i=0; i