diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-03-12 01:12:29 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-03-12 01:12:29 +0300 |
commit | f6000c9088ee63428f65ee980f6751f85a7e7d7e (patch) | |
tree | 2469c6a12f735aec2e55a05a539f11d1ef693496 /src/resources/resourcemanager.cpp | |
parent | 17dcb835103ac05012c5a7eafa8c7702cef53390 (diff) | |
download | plus-f6000c9088ee63428f65ee980f6751f85a7e7d7e.tar.gz plus-f6000c9088ee63428f65ee980f6751f85a7e7d7e.tar.bz2 plus-f6000c9088ee63428f65ee980f6751f85a7e7d7e.tar.xz plus-f6000c9088ee63428f65ee980f6751f85a7e7d7e.zip |
Add all files delete function to resource manager.
Diffstat (limited to 'src/resources/resourcemanager.cpp')
-rw-r--r-- | src/resources/resourcemanager.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index e8e9f14c1..9a4d1c3f1 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -42,6 +42,7 @@ #include <SDL_image.h> #include <cassert> +#include <dirent.h> #include <fstream> #include <iostream> #include <sstream> @@ -1104,3 +1105,18 @@ void ResourceManager::removeDelayLoad(const AnimationDelayLoad } } } + +void ResourceManager::deleteFilesInDirectory(std::string path) +{ + path += "/"; + struct dirent *next_file; + DIR *dir = opendir(path.c_str()); + + while ((next_file = readdir(dir))) + { + const std::string file = next_file->d_name; + const std::string name = path + file; + if (file != "." && file != "..") + remove(name.c_str()); + } +} |