diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-02-14 18:00:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-02-14 18:00:20 +0300 |
commit | 5283a59db971ec2038149bf26ad9b3cbc4924449 (patch) | |
tree | c2f208b197a3726d6358ca707b64d01887bb6151 /src/utils/virtfstools.cpp | |
parent | 59146da772888a295bbf8613f32bce5dd7bb00ab (diff) | |
download | manaverse-5283a59db971ec2038149bf26ad9b3cbc4924449.tar.gz manaverse-5283a59db971ec2038149bf26ad9b3cbc4924449.tar.bz2 manaverse-5283a59db971ec2038149bf26ad9b3cbc4924449.tar.xz manaverse-5283a59db971ec2038149bf26ad9b3cbc4924449.zip |
Add virtlist for file names enumeration in virtfs.
Diffstat (limited to 'src/utils/virtfstools.cpp')
-rw-r--r-- | src/utils/virtfstools.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/utils/virtfstools.cpp b/src/utils/virtfstools.cpp index f7f1f793f..d804dfd41 100644 --- a/src/utils/virtfstools.cpp +++ b/src/utils/virtfstools.cpp @@ -23,6 +23,7 @@ #include "logger.h" #include "utils/virtfs.h" +#include "utils/virtlist.h" #include "debug.h" @@ -59,16 +60,16 @@ namespace VirtFs const std::string &restrict ext, const Append append) { - char **list = VirtFs::enumerateFiles(path.c_str()); - - for (char **i = list; *i; i++) + VirtList *const list = VirtFs::enumerateFiles(path); + FOR_EACH (StringVectCIter, i, list->names) { - const size_t len = strlen(*i); + const std::string str = *i; + const size_t len = str.size(); if (len > ext.length() && - !ext.compare((*i) + (len - ext.length()))) + !ext.compare(str.substr(len - ext.length()))) { - const std::string file = path + (*i); + const std::string file = path + str; const std::string realPath = std::string( VirtFs::getRealDir(file.c_str())); VirtFs::addZipToSearchPath(std::string(realPath).append( @@ -81,15 +82,15 @@ namespace VirtFs void searchAndRemoveArchives(const std::string &restrict path, const std::string &restrict ext) { - char **list = VirtFs::enumerateFiles(path.c_str()); - - for (char **i = list; *i; i++) + VirtList *const list = VirtFs::enumerateFiles(path); + FOR_EACH (StringVectCIter, i, list->names) { - const size_t len = strlen(*i); + const std::string str = *i; + const size_t len = str.size(); if (len > ext.length() && - !ext.compare((*i) + (len - ext.length()))) + !ext.compare(str.substr(len - ext.length()))) { - const std::string file = path + (*i); + const std::string file = path + str; const std::string realPath = std::string( VirtFs::getRealDir(file.c_str())); VirtFs::removeZipFromSearchPath(std::string( |