diff --git a/src/browsedialog.cpp b/src/browsedialog.cpp index 0e972e1..cfa47f2 100644 --- a/src/browsedialog.cpp +++ b/src/browsedialog.cpp @@ -45,7 +45,7 @@ bool BrowseDialog::exec() return false; string path = fl->getPath(); - if (path.empty() || !fileExists(path) || path.compare(0, 5, CARD_ROOT) != 0) + if (path.empty() || !fileExists(path) || path.compare(0, CARD_ROOT_LEN, CARD_ROOT) != 0) setPath(CARD_ROOT); fl->browse(); @@ -166,8 +166,8 @@ void BrowseDialog::directoryUp() if (p == path.size() - 1) p = path.rfind("/", p - 1); - - if (p == string::npos || p < 4 || path.compare(0, 5, CARD_ROOT) != 0) { + + if (p == string::npos || path.compare(0, CARD_ROOT_LEN, CARD_ROOT) != 0 || path.length() <= CARD_ROOT_LEN) { close = true; result = false; } else { diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index f9ec5a7..dc7a67d 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -77,7 +77,8 @@ //#include #endif -const char *CARD_ROOT = "/card"; +const char *CARD_ROOT = "/"; //Note: Add a trailing /! +const int CARD_ROOT_LEN = 1; using namespace std; using namespace fastdelegate; @@ -1006,7 +1007,7 @@ void GMenu2X::main() { } void GMenu2X::explorer() { - FileDialog fd(this,tr["Select an application"],".gpu,.dge,.sh"); + FileDialog fd(this,tr["Select an application"],".gpu,.dge,.sh,"); if (fd.exec()) { if (confInt["saveSelection"] && (confInt["section"]!=menu->selSectionIndex() || confInt["link"]!=menu->selLinkIndex())) writeConfig(); @@ -1063,10 +1064,11 @@ void GMenu2X::options() { if (curGlobalVolume!=confInt["globalVolume"]) setVolume(confInt["globalVolume"]); if (lang == "English") lang = ""; if (lang != tr.lang()) tr.setLang(lang); - if (fileExists(CARD_ROOT) && !showRootFolder) + /*if (fileExists(CARD_ROOT) && !showRootFolder) unlink(CARD_ROOT); else if (!fileExists(CARD_ROOT) && showRootFolder) - symlink("/", CARD_ROOT); + symlink("/", CARD_ROOT);*/ + //WARNING: Disabled because these functions get dangerous when run with / as CARD_ROOT writeConfig(); } } diff --git a/src/gmenu2x.h b/src/gmenu2x.h index aba0d34..cf13c43 100644 --- a/src/gmenu2x.h +++ b/src/gmenu2x.h @@ -49,6 +49,7 @@ const int BATTERY_READS = 10; const int LOOP_DELAY=30000; extern const char *CARD_ROOT; +extern const int CARD_ROOT_LEN; extern void jz_cpuspeed(unsigned clockspeed); diff --git a/src/selector.cpp b/src/selector.cpp index dd27006..70cc0fd 100644 --- a/src/selector.cpp +++ b/src/selector.cpp @@ -152,7 +152,7 @@ int Selector::exec(int startSelection) { if ( gmenu2x->input[ACTION_X] ) { if (link->getSelectorBrowser()) { string::size_type p = dir.rfind("/", dir.size()-2); - if (p==string::npos || dir.compare(0, 5, CARD_ROOT) != 0 || p<4) { + if (p==string::npos || dir.compare(0, CARD_ROOT_LEN, CARD_ROOT) != 0 || dir.length() <= CARD_ROOT_LEN) { close = true; result = false; } else {