summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/files.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/utils/files.cpp b/src/utils/files.cpp
index 463031493..6f7ae3147 100644
--- a/src/utils/files.cpp
+++ b/src/utils/files.cpp
@@ -355,14 +355,16 @@ void Files::deleteFilesInDirectory(std::string path)
const struct dirent *next_file = nullptr;
DIR *const dir = opendir(path.c_str());
- while ((next_file = readdir(dir)))
- {
- const std::string file = next_file->d_name;
- if (file != "." && file != "..")
- remove((path + file).c_str());
- }
if (dir)
+ {
+ while ((next_file = readdir(dir)))
+ {
+ const std::string file = next_file->d_name;
+ if (file != "." && file != "..")
+ remove((path + file).c_str());
+ }
closedir(dir);
+ }
}
void Files::getFilesInDir(const std::string &dir,