diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-04-24 03:35:02 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-04-24 04:35:35 +0300 |
commit | 0835e09ee3a6c83ffa01454f2c05597e6195b07d (patch) | |
tree | b3b79b7a8f58f2ff18ec66b17d1c39ddad085e11 /src/fs/virtfs/virtfs.cpp | |
parent | 55458f743c3ff7e42288bc08033481d8464dca62 (diff) | |
download | manaverse-0835e09ee3a6c83ffa01454f2c05597e6195b07d.tar.gz manaverse-0835e09ee3a6c83ffa01454f2c05597e6195b07d.tar.bz2 manaverse-0835e09ee3a6c83ffa01454f2c05597e6195b07d.tar.xz manaverse-0835e09ee3a6c83ffa01454f2c05597e6195b07d.zip |
Improve VirtFs::getFiles.
Diffstat (limited to 'src/fs/virtfs/virtfs.cpp')
-rw-r--r-- | src/fs/virtfs/virtfs.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/fs/virtfs/virtfs.cpp b/src/fs/virtfs/virtfs.cpp index d9423f66e..e61069301 100644 --- a/src/fs/virtfs/virtfs.cpp +++ b/src/fs/virtfs/virtfs.cpp @@ -161,6 +161,28 @@ namespace VirtFs return list; } + void getFiles(std::string dirName, + StringVect &list) + { + prepareFsPath(dirName); + if (checkPath(dirName) == false) + { + reportAlways("VirtFs::enumerateFiles invalid path: %s", + dirName.c_str()); + return; + } + + std::string rootDir = dirName; + if (findLast(rootDir, std::string(dirSeparator)) == false) + rootDir += dirSeparator; + + FOR_EACH (std::vector<VirtFsEntry*>::const_iterator, it, mEntries) + { + VirtFsEntry *const entry = *it; + entry->funcs->getFiles(entry, rootDir, list); + } + } + bool isDirectory(std::string name) { prepareFsPath(name); |