diff options
Diffstat (limited to 'common/archive.cpp')
-rw-r--r-- | common/archive.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/common/archive.cpp b/common/archive.cpp index bdea62b895..18c918f914 100644 --- a/common/archive.cpp +++ b/common/archive.cpp @@ -25,12 +25,34 @@ #include "common/archive.h" #include "common/fs.h" -#include "common/file.h" #include "common/util.h" namespace Common { +int Archive::matchPattern(StringList &list, const String &pattern) { + // Get all "names" (TODO: "files" ?) + StringList allNames; + getAllNames(allNames); + + int matches = 0; + + // need to match lowercase key + String lowercasePattern = pattern; + lowercasePattern.toLowercase(); + + StringList::iterator it = allNames.begin(); + for ( ; it != allNames.end(); it++) { + if (matchString(it->c_str(), lowercasePattern.c_str())) { + list.push_back(*it); + matches++; + } + } + + return matches; +} + + FSDirectory::FSDirectory(const FilesystemNode &node, int depth) : _node(node), _cached(false), _depth(depth) { } @@ -158,7 +180,8 @@ int FSDirectory::matchPattern(StringList &list, const String &pattern) { NodeCache::iterator it = _fileCache.begin(); for ( ; it != _fileCache.end(); it++) { if (matchString((*it)._key.c_str(), lowercasePattern.c_str())) { - list.push_back((*it)._key.c_str()); + list.push_back((*it)._key); + matches++; } } @@ -283,5 +306,4 @@ SeekableReadStream *SearchSet::openFile(const String &name) { return 0; } - } // namespace Common |