summaryrefslogtreecommitdiff
path: root/src/utils/files.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-22 18:30:22 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-22 18:30:22 +0300
commit1ee6d71c1d771ab8a990ef427a59f54132910ac7 (patch)
tree39c63dab7d76356a588ea2202427b29d50e1e7dd /src/utils/files.cpp
parent7f72738f54abef2ec0ae080b58bbfde1c3c02c36 (diff)
downloadmanaplus-1ee6d71c1d771ab8a990ef427a59f54132910ac7.tar.gz
manaplus-1ee6d71c1d771ab8a990ef427a59f54132910ac7.tar.bz2
manaplus-1ee6d71c1d771ab8a990ef427a59f54132910ac7.tar.xz
manaplus-1ee6d71c1d771ab8a990ef427a59f54132910ac7.zip
Add some cppcheck fixes.
Diffstat (limited to 'src/utils/files.cpp')
-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,