aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2008-11-21 12:17:35 +0000
committerMax Horn2008-11-21 12:17:35 +0000
commita28b531ed0a984aa89a6cbc55c0314ad52f304fb (patch)
tree492d7aae224da496b3d3f176833da02c617bb0f9
parent33dd58ca9894676c52498498eb5d19e48e3cc998 (diff)
downloadscummvm-rg350-a28b531ed0a984aa89a6cbc55c0314ad52f304fb.tar.gz
scummvm-rg350-a28b531ed0a984aa89a6cbc55c0314ad52f304fb.tar.bz2
scummvm-rg350-a28b531ed0a984aa89a6cbc55c0314ad52f304fb.zip
Added ArchiveMember::getDisplayName() method; changed ArchiveMember::getName() to always return a name compatible with Archive::openFile()
svn-id: r35139
-rw-r--r--common/archive.cpp15
-rw-r--r--common/archive.h3
-rw-r--r--engines/kyra/resource_intern.cpp6
-rw-r--r--gui/ThemeEngine.cpp4
4 files changed, 12 insertions, 16 deletions
diff --git a/common/archive.cpp b/common/archive.cpp
index d494c6ceb4..85586c2820 100644
--- a/common/archive.cpp
+++ b/common/archive.cpp
@@ -76,14 +76,11 @@ public:
FSDirectoryMember(FSNode &node) : _node(node) {
}
- /*
- NOTE/FIXME: since I assume that the only use case for getName()
- is for error messages, I am returning the full path of the node
- here. This seems better than we did before, when matchPattern
- and getAllNames used to work with StringList, and we used to
- put the relative path of the file to the list instead.
- */
String getName() const {
+ return _node.getName();
+ }
+
+ String getDisplayName() const {
return _node.getPath();
}
@@ -92,8 +89,6 @@ public:
}
};
-typedef SharedPtr<FSDirectoryMember> FSDirectoryMemberPtr;
-
FSDirectory::FSDirectory(const FSNode &node, int depth)
: _node(node), _cached(false), _depth(depth) {
}
@@ -259,7 +254,7 @@ int FSDirectory::listMatchingMembers(ArchiveMemberList &list, const String &patt
NodeCache::iterator it = _fileCache.begin();
for ( ; it != _fileCache.end(); it++) {
if ((*it)._key.matchString(lowercasePattern)) {
- list.push_back(FSDirectoryMemberPtr(new FSDirectoryMember((*it)._value)));
+ list.push_back(ArchiveMemberPtr(new FSDirectoryMember((*it)._value)));
matches++;
}
}
diff --git a/common/archive.h b/common/archive.h
index 5aca4bd450..a11d02e5af 100644
--- a/common/archive.h
+++ b/common/archive.h
@@ -47,8 +47,9 @@ namespace Common {
class ArchiveMember {
public:
virtual ~ArchiveMember() { }
- virtual String getName() const = 0;
virtual SeekableReadStream *open() = 0;
+ virtual String getName() const = 0;
+ virtual String getDisplayName() const { return getName(); }
};
typedef SharedPtr<ArchiveMember> ArchiveMemberPtr;
diff --git a/engines/kyra/resource_intern.cpp b/engines/kyra/resource_intern.cpp
index cbb6dc4f0c..341f9a6735 100644
--- a/engines/kyra/resource_intern.cpp
+++ b/engines/kyra/resource_intern.cpp
@@ -229,7 +229,7 @@ Common::Archive *ResLoaderPak::load(Common::SharedPtr<Common::ArchiveMember> mem
while (!stream.eos()) {
// The start offset of a file should never be in the filelist
if (startoffset < stream.pos() || startoffset > filesize) {
- warning("PAK file '%s' is corrupted", memberFile->getName().c_str());
+ warning("PAK file '%s' is corrupted", memberFile->getDisplayName().c_str());
return false;
}
@@ -240,14 +240,14 @@ Common::Archive *ResLoaderPak::load(Common::SharedPtr<Common::ArchiveMember> mem
file += c;
if (stream.eos()) {
- warning("PAK file '%s' is corrupted", memberFile->getName().c_str());
+ warning("PAK file '%s' is corrupted", memberFile->getDisplayName().c_str());
return false;
}
// Quit now if we encounter an empty string
if (file.empty()) {
if (firstFile) {
- warning("PAK file '%s' is corrupted", memberFile->getName().c_str());
+ warning("PAK file '%s' is corrupted", memberFile->getDisplayName().c_str());
return false;
} else {
break;
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 90ab2e211f..11b960a91b 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -550,14 +550,14 @@ bool ThemeEngine::loadThemeXML(const Common::String &themeName) {
if (_parser->loadStream((*i)->open()) == false) {
delete archive;
- warning("Failed to load STX file '%s'", (*i)->getName().c_str());
+ warning("Failed to load STX file '%s'", (*i)->getDisplayName().c_str());
_parser->close();
return false;
}
if (_parser->parse() == false) {
delete archive;
- warning("Failed to parse STX file '%s'", (*i)->getName().c_str());
+ warning("Failed to parse STX file '%s'", (*i)->getDisplayName().c_str());
_parser->close();
return false;
}