From b63228c6759d09951c5303979bf3c7e97840a7c9 Mon Sep 17 00:00:00 2001 From: Nathan Phillips Date: Fri, 17 Mar 2017 10:59:21 +0000 Subject: [PATCH] delete_directory fails silently on subfolders --- src/util/file_util.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/util/file_util.cpp b/src/util/file_util.cpp index 5999d15ebf..7cfea942a0 100644 --- a/src/util/file_util.cpp +++ b/src/util/file_util.cpp @@ -107,7 +107,13 @@ void delete_directory(const std::string &path) struct dirent *ent; while((ent=readdir(dir))!=NULL) - remove((path+"/"+ent->d_name).c_str()); + { + std::string sub_path=path+"/"+ent->d_name; + if(ent->d_type==DT_DIR) + delete_directory(sub_path); + else + remove(sub_path.c_str()); + } closedir(dir); }