[Scummvm-cvs-logs] scummvm master -> 473337effd7992940c0e84e5dc85062d03fa47c0

lordhoto lordhoto at gmail.com
Sat May 7 16:04:14 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
473337effd GUI: Allow .zip files with case differing from ".zip" as theme files too.


Commit: 473337effd7992940c0e84e5dc85062d03fa47c0
    https://github.com/scummvm/scummvm/commit/473337effd7992940c0e84e5dc85062d03fa47c0
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-05-07T06:49:57-07:00

Commit Message:
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.

Changed paths:
    gui/ThemeEngine.cpp



diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 7fe4054..098cb8e 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)






More information about the Scummvm-git-logs mailing list