diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-18 20:02:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-18 20:02:27 +0300 |
commit | fb5d0e7762f692948dddebd3deb38a0bd20de5f2 (patch) | |
tree | afe2c0d8cf75738fd847af37dc166e0c338f7493 /src/utils/files.cpp | |
parent | 8a5603e487f682f5f67bc2cedae81249aa138f5b (diff) | |
parent | e9e343366fbfbe9a6343089ff113354524f3f306 (diff) | |
download | plus-fb5d0e7762f692948dddebd3deb38a0bd20de5f2.tar.gz plus-fb5d0e7762f692948dddebd3deb38a0bd20de5f2.tar.bz2 plus-fb5d0e7762f692948dddebd3deb38a0bd20de5f2.tar.xz plus-fb5d0e7762f692948dddebd3deb38a0bd20de5f2.zip |
Merge branch 'master' into stable
Diffstat (limited to 'src/utils/files.cpp')
-rw-r--r-- | src/utils/files.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/utils/files.cpp b/src/utils/files.cpp index 206a4d4bd..24ec9366e 100644 --- a/src/utils/files.cpp +++ b/src/utils/files.cpp @@ -22,10 +22,10 @@ #if defined(ANDROID) || defined(__native_client__) #include "resources/resourcemanager.h" -#include "utils/physfstools.h" #endif #include "utils/mkdir.h" +#include "utils/physfstools.h" #include "localconsts.h" @@ -196,3 +196,36 @@ int Files::copyFile(const std::string &restrict srcName, fclose(dstFile); return 0; } + +void Files::getFiles(const std::string &path, StringVect &list) +{ + char **fonts = PhysFs::enumerateFiles(path.c_str()); + for (char *const *i = fonts; *i; i++) + { + if (!PhysFs::isDirectory((path + *i).c_str())) + list.push_back(*i); + } + PhysFs::freeList(fonts); +} + +void Files::getDirs(const std::string &path, StringVect &list) +{ + char **fonts = PhysFs::enumerateFiles(path.c_str()); + for (char *const *i = fonts; *i; i++) + { + if (PhysFs::isDirectory((path + *i).c_str())) + list.push_back(*i); + } + PhysFs::freeList(fonts); +} + +void Files::getFilesWithDir(const std::string &path, StringVect &list) +{ + char **fonts = PhysFs::enumerateFiles(path.c_str()); + for (char *const *i = fonts; *i; i++) + { + if (!PhysFs::isDirectory((path + *i).c_str())) + list.push_back(path + *i); + } + PhysFs::freeList(fonts); +} |