aboutsummaryrefslogtreecommitdiff
path: root/common/archive.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2008-11-21 13:29:53 +0000
committerWillem Jan Palenstijn2008-11-21 13:29:53 +0000
commit196e2cc92c894ea9449c96a10f2373fd605cc2dc (patch)
tree040c4e2d182fbbc8e3ace96b02b9a1d4328160be /common/archive.cpp
parenta28b531ed0a984aa89a6cbc55c0314ad52f304fb (diff)
downloadscummvm-rg350-196e2cc92c894ea9449c96a10f2373fd605cc2dc.tar.gz
scummvm-rg350-196e2cc92c894ea9449c96a10f2373fd605cc2dc.tar.bz2
scummvm-rg350-196e2cc92c894ea9449c96a10f2373fd605cc2dc.zip
refactor inconsistent calls to cacheDirectoryRecursive
svn-id: r35140
Diffstat (limited to 'common/archive.cpp')
-rw-r--r--common/archive.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/common/archive.cpp b/common/archive.cpp
index 85586c2820..ce640557e7 100644
--- a/common/archive.cpp
+++ b/common/archive.cpp
@@ -127,10 +127,7 @@ FSNode FSDirectory::getFSNode() const {
FSNode FSDirectory::lookupCache(NodeCache &cache, const String &name) {
// make caching as lazy as possible
if (!name.empty()) {
- if (!_cached) {
- cacheDirectoryRecursive(_node, _depth, _prefix);
- _cached = true;
- }
+ ensureCached();
if (cache.contains(name))
return cache[name];
@@ -237,15 +234,19 @@ void FSDirectory::cacheDirectoryRecursive(FSNode node, int depth, const String&
}
+void FSDirectory::ensureCached()
+{
+ if (_cached) return;
+ cacheDirectoryRecursive(_node, _depth, _prefix);
+ _cached = true;
+}
+
int FSDirectory::listMatchingMembers(ArchiveMemberList &list, const String &pattern) {
if (!_node.isDirectory())
return 0;
// Cache dir data
- if (!_cached) {
- cacheDirectoryRecursive(_node, _depth, "");
- _cached = true;
- }
+ ensureCached();
String lowercasePattern(pattern);
lowercasePattern.toLowercase();