diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-10 01:50:12 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-10 02:35:02 +0300 |
commit | 2317fbe9d29f5bea76a2ba05b40841b11de1a6f2 (patch) | |
tree | 121a1cdf207e47798050bf648265bb9b3f9ef65f /src/utils | |
parent | 0b4614a2d3dee49097b8131150df21ef585bf854 (diff) | |
download | manaplus-2317fbe9d29f5bea76a2ba05b40841b11de1a6f2.tar.gz manaplus-2317fbe9d29f5bea76a2ba05b40841b11de1a6f2.tar.bz2 manaplus-2317fbe9d29f5bea76a2ba05b40841b11de1a6f2.tar.xz manaplus-2317fbe9d29f5bea76a2ba05b40841b11de1a6f2.zip |
fix dirs and files enumeration in some systems.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/files.cpp | 11 | ||||
-rw-r--r-- | src/utils/files.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/utils/files.cpp b/src/utils/files.cpp index 9abf13593..39451b129 100644 --- a/src/utils/files.cpp +++ b/src/utils/files.cpp @@ -208,6 +208,17 @@ void Files::getFiles(const std::string &path, StringVect &list) PhysFs::freeList(fonts); } +void Files::getDirs(const std::string &path, StringVect &list) +{ + char **fonts = PhysFs::enumerateFiles(path.c_str()); + for (char **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()); diff --git a/src/utils/files.h b/src/utils/files.h index 9363f96da..2046b8ac9 100644 --- a/src/utils/files.h +++ b/src/utils/files.h @@ -57,6 +57,8 @@ namespace Files void getFiles(const std::string &path, StringVect &list); + void getDirs(const std::string &path, StringVect &list); + void getFilesWithDir(const std::string &restrict path, StringVect &restrict list); } // namespace Files |