[Scummvm-cvs-logs] SF.net SVN: scummvm:[34713] scummvm/trunk/gui

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Sep 30 19:09:45 CEST 2008


Revision: 34713
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34713&view=rev
Author:   fingolfin
Date:     2008-09-30 17:09:41 +0000 (Tue, 30 Sep 2008)

Log Message:
-----------
Fix ThemeBrowser to use FSNodes, not getPath()

Modified Paths:
--------------
    scummvm/trunk/gui/themebrowser.cpp
    scummvm/trunk/gui/themebrowser.h

Modified: scummvm/trunk/gui/themebrowser.cpp
===================================================================
--- scummvm/trunk/gui/themebrowser.cpp	2008-09-30 16:55:10 UTC (rev 34712)
+++ scummvm/trunk/gui/themebrowser.cpp	2008-09-30 17:09:41 UTC (rev 34713)
@@ -101,10 +101,10 @@
 	// files in other places are ignored in this dialog
 	// TODO: let the user browse the complete FS too/only the FS?
 	if (ConfMan.hasKey("themepath"))
-		addDir(_themes, ConfMan.get("themepath"), 0);
+		addDir(_themes, Common::FilesystemNode(ConfMan.get("themepath")), 0);
 
 #ifdef DATA_PATH
-	addDir(_themes, DATA_PATH);
+	addDir(_themes, Common::FilesystemNode(DATA_PATH));
 #endif
 
 #ifdef MACOSX
@@ -112,7 +112,7 @@
 	if (resourceUrl) {
 		char buf[256];
 		if (CFURLGetFileSystemRepresentation(resourceUrl, true, (UInt8 *)buf, 256)) {
-			Common::String resourcePath = buf;
+			Common::FilesystemNode resourcePath(buf);
 			addDir(_themes, resourcePath, 0);
 		}
 		CFRelease(resourceUrl);
@@ -120,9 +120,9 @@
 #endif
 
 	if (ConfMan.hasKey("extrapath"))
-		addDir(_themes, ConfMan.get("extrapath"));
+		addDir(_themes, Common::FilesystemNode(ConfMan.get("extrapath")));
 
-	addDir(_themes, ".", 0);
+	addDir(_themes, Common::FilesystemNode("."), 0);
 
 	// Populate the ListWidget
 	Common::StringList list;
@@ -137,12 +137,10 @@
 	draw();
 }
 
-void ThemeBrowser::addDir(ThList &list, const Common::String &dir, int level) {
+void ThemeBrowser::addDir(ThList &list, const Common::FilesystemNode &node, int level) {
 	if (level < 0)
 		return;
 
-	Common::FilesystemNode node(dir);
-
 	if (!node.exists() || !node.isReadable())
 		return;
 
@@ -152,7 +150,7 @@
 
 	for (Common::FSList::const_iterator i = fslist.begin(); i != fslist.end(); ++i) {
 		if (i->isDirectory()) {
-			addDir(list, i->getPath(), level-1);
+			addDir(list, *i, level-1);
 		} else {
 			Entry th;
 			if (isTheme(*i, th)) {
@@ -176,7 +174,8 @@
 	Common::String type;
 
 	out.file = node.getName();
-	for (int i = out.file.size()-1; out.file[i] != '.' && i > 0; --i) {
+	// Remove the filename extension
+	while (out.file.lastChar() != '.') {
 		out.file.deleteLastChar();
 	}
 	out.file.deleteLastChar();

Modified: scummvm/trunk/gui/themebrowser.h
===================================================================
--- scummvm/trunk/gui/themebrowser.h	2008-09-30 16:55:10 UTC (rev 34712)
+++ scummvm/trunk/gui/themebrowser.h	2008-09-30 17:09:41 UTC (rev 34713)
@@ -57,7 +57,7 @@
 
 	void updateListing();
 
-	void addDir(ThList &list, const Common::String &dir, int level = 4);
+	void addDir(ThList &list, const Common::FilesystemNode &node, int level = 4);
 	bool isTheme(const Common::FilesystemNode &node, Entry &out);
 };
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list