aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorMax Horn2008-09-30 17:09:41 +0000
committerMax Horn2008-09-30 17:09:41 +0000
commitd2c0facc6afdf33f45e82cd28f13a27ff9fa2017 (patch)
tree225f51a8caa5fb2314f813525b7b5043d8d5878f /gui
parentd4cb443af74b6447244692ca0f4126c2721b41b4 (diff)
downloadscummvm-rg350-d2c0facc6afdf33f45e82cd28f13a27ff9fa2017.tar.gz
scummvm-rg350-d2c0facc6afdf33f45e82cd28f13a27ff9fa2017.tar.bz2
scummvm-rg350-d2c0facc6afdf33f45e82cd28f13a27ff9fa2017.zip
Fix ThemeBrowser to use FSNodes, not getPath()
svn-id: r34713
Diffstat (limited to 'gui')
-rw-r--r--gui/themebrowser.cpp19
-rw-r--r--gui/themebrowser.h2
2 files changed, 10 insertions, 11 deletions
diff --git a/gui/themebrowser.cpp b/gui/themebrowser.cpp
index bf718d5e4a..6957ddcafa 100644
--- a/gui/themebrowser.cpp
+++ b/gui/themebrowser.cpp
@@ -101,10 +101,10 @@ void ThemeBrowser::updateListing() {
// 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 @@ void ThemeBrowser::updateListing() {
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 @@ void ThemeBrowser::updateListing() {
#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 @@ void ThemeBrowser::updateListing() {
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 @@ void ThemeBrowser::addDir(ThList &list, const Common::String &dir, int level) {
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 @@ bool ThemeBrowser::isTheme(const Common::FilesystemNode &node, Entry &out) {
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();
diff --git a/gui/themebrowser.h b/gui/themebrowser.h
index e16a329c0e..fb378d9c66 100644
--- a/gui/themebrowser.h
+++ b/gui/themebrowser.h
@@ -57,7 +57,7 @@ private:
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);
};