aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2011-05-07 15:49:57 +0200
committerJohannes Schickel2011-05-07 15:49:57 +0200
commit473337effd7992940c0e84e5dc85062d03fa47c0 (patch)
tree0911565529ae400bdfd4ebd41f1de934ed44d218
parent3e1b3baaacbf29e2c768879144b0ed36fe605bd8 (diff)
downloadscummvm-rg350-473337effd7992940c0e84e5dc85062d03fa47c0.tar.gz
scummvm-rg350-473337effd7992940c0e84e5dc85062d03fa47c0.tar.bz2
scummvm-rg350-473337effd7992940c0e84e5dc85062d03fa47c0.zip
GUI: Allow .zip files with case differing from ".zip" as theme files too.
Formerly our code used "hasSuffix" to check for a ".zip" suffix. Since hasSuffix does a case-sensitive match that would not work, in case the file was called "scummmodern.ZIP" instead of "scummmodern.zip" for example. To fix that I am using a case-insensitive matchString instead now.
-rw-r--r--gui/ThemeEngine.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 7fe40542c2..098cb8e0ac 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -391,7 +391,7 @@ bool ThemeEngine::init() {
Common::FSNode node(_themeFile);
if (node.isDirectory()) {
_themeArchive = new Common::FSDirectory(node);
- } else if (_themeFile.hasSuffix(".zip")) {
+ } else if (_themeFile.matchString("*.zip", true)) {
// TODO: Also use "node" directly?
// Look for the zip file via SearchMan
Common::ArchiveMemberPtr member = SearchMan.getMember(_themeFile);
@@ -1535,7 +1535,7 @@ bool ThemeEngine::themeConfigUsable(const Common::ArchiveMember &member, Common:
Common::File stream;
bool foundHeader = false;
- if (member.getName().hasSuffix(".zip")) {
+ if (member.getName().matchString("*.zip", true)) {
Common::Archive *zipArchive = Common::makeZipArchive(member.createReadStream());
if (zipArchive && zipArchive->hasFile("THEMERC")) {
@@ -1557,7 +1557,7 @@ bool ThemeEngine::themeConfigUsable(const Common::FSNode &node, Common::String &
Common::File stream;
bool foundHeader = false;
- if (node.getName().hasSuffix(".zip") && !node.isDirectory()) {
+ if (node.getName().matchString("*.zip", true) && !node.isDirectory()) {
Common::Archive *zipArchive = Common::makeZipArchive(node);
if (zipArchive && zipArchive->hasFile("THEMERC")) {
// Open THEMERC from the ZIP file.
@@ -1643,7 +1643,7 @@ void ThemeEngine::listUsableThemes(Common::Archive &archive, Common::List<ThemeD
// If the name of the node object also contains
// the ".zip" suffix, we will strip it.
- if (td.id.hasSuffix(".zip")) {
+ if (td.id.matchString("*.zip", true)) {
for (int j = 0; j < 4; ++j)
td.id.deleteLastChar();
}
@@ -1680,7 +1680,7 @@ void ThemeEngine::listUsableThemes(const Common::FSNode &node, Common::List<Them
for (Common::FSList::iterator i = fileList.begin(); i != fileList.end(); ++i) {
// We will only process zip files for now
- if (!i->getPath().hasSuffix(".zip"))
+ if (!i->getPath().matchString("*.zip", true))
continue;
td.name.clear();
@@ -1690,7 +1690,7 @@ void ThemeEngine::listUsableThemes(const Common::FSNode &node, Common::List<Them
// If the name of the node object also contains
// the ".zip" suffix, we will strip it.
- if (td.id.hasSuffix(".zip")) {
+ if (td.id.matchString("*.zip", true)) {
for (int j = 0; j < 4; ++j)
td.id.deleteLastChar();
}
@@ -1727,7 +1727,7 @@ Common::String ThemeEngine::getThemeFile(const Common::String &id) {
Common::FSNode node(id);
// If the given id is a full path we'll just use it
- if (node.exists() && (node.isDirectory() || node.getName().hasSuffix(".zip")))
+ if (node.exists() && (node.isDirectory() || node.getName().matchString("*.zip", true)))
return id;
// FIXME:
@@ -1758,7 +1758,7 @@ Common::String ThemeEngine::getThemeId(const Common::String &filename) {
if (!node.exists())
return "builtin";
- if (node.getName().hasSuffix(".zip")) {
+ if (node.getName().matchString("*.zip", true)) {
Common::String id = node.getName();
for (int i = 0; i < 4; ++i)