diff --git a/src/browsedialog.cpp b/src/browsedialog.cpp index e17f27a..9c2284a 100644 --- a/src/browsedialog.cpp +++ b/src/browsedialog.cpp @@ -4,6 +4,7 @@ #include "FastDelegate.h" #include "filelister.h" +#include "gmenu2x.h" using namespace fastdelegate; @@ -40,8 +41,8 @@ bool BrowseDialog::exec() return false; string path = fl->getPath(); - if (path.empty() || !fileExists(path) || path.compare(0, 5, "/card") != 0) - setPath("/card"); + if (path.empty() || !fileExists(path) || path.compare(0, 5, CARD_ROOT) != 0) + setPath(CARD_ROOT); fl->browse(); @@ -161,7 +162,7 @@ void BrowseDialog::directoryUp() if (p == path.size() - 1) p = path.rfind("/", p - 1); - if (p == string::npos || p < 4 || path.compare(0, 5, "/card") != 0) { + if (p == string::npos || p < 4 || path.compare(0, 5, CARD_ROOT) != 0) { close = true; result = false; } else { diff --git a/src/filedialog.cpp b/src/filedialog.cpp index 3acd5df..18b55f1 100644 --- a/src/filedialog.cpp +++ b/src/filedialog.cpp @@ -19,6 +19,7 @@ ***************************************************************************/ #include "filedialog.h" +#include "gmenu2x.h" using namespace std; @@ -26,7 +27,7 @@ FileDialog::FileDialog(GMenu2X *gmenu2x, const string &text, const string &filter, const string &file, const string &title) : BrowseDialog(gmenu2x, title, text) { - string path = "/card"; + string path(CARD_ROOT); if (!file.empty()) { string::size_type pos = file.rfind("/"); if (pos != string::npos) diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index 134de51..bf61437 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -76,6 +76,8 @@ //#include #endif +const char *CARD_ROOT = "/card"; + using namespace std; using namespace fastdelegate; @@ -420,7 +422,7 @@ void GMenu2X::initMenu() { menu->loadIcons(); //DEBUG - //menu->addLink( "/card", "sample.pxml", "applications" ); + //menu->addLink( CARD_ROOT, "sample.pxml", "applications" ); } void GMenu2X::about() { @@ -1025,7 +1027,7 @@ void GMenu2X::options() { int curGlobalVolume = confInt["globalVolume"]; //G int prevbacklight = confInt["backlight"]; - bool showRootFolder = fileExists("/card"); + bool showRootFolder = fileExists(CARD_ROOT); FileLister fl_tr("translations"); fl_tr.browse(); @@ -1055,10 +1057,10 @@ void GMenu2X::options() { if (curGlobalVolume!=confInt["globalVolume"]) setVolume(confInt["globalVolume"]); if (lang == "English") lang = ""; if (lang != tr.lang()) tr.setLang(lang); - if (fileExists("/card") && !showRootFolder) - unlink("/card"); - else if (!fileExists("/card") && showRootFolder) - symlink("/","/card"); + if (fileExists(CARD_ROOT) && !showRootFolder) + unlink(CARD_ROOT); + else if (!fileExists(CARD_ROOT) && showRootFolder) + symlink("/", CARD_ROOT); writeConfig(); } } @@ -1603,7 +1605,7 @@ void GMenu2X::scanner() { lineY += 26; vector files; - scanPath("/card",&files); + scanPath(CARD_ROOT, &files); //Onyl gph firmware has nand /* if (fwType=="gph" && !f200) { @@ -1890,7 +1892,7 @@ string GMenu2X::getDiskFree() { string df = ""; struct statvfs b; - int ret = statvfs("/card", &b); + int ret = statvfs(CARD_ROOT, &b); if (ret==0) { // Make sure that the multiplication happens in 64 bits. unsigned long long free = diff --git a/src/gmenu2x.h b/src/gmenu2x.h index d9b0efe..7fc5538 100644 --- a/src/gmenu2x.h +++ b/src/gmenu2x.h @@ -45,6 +45,8 @@ const int BATTERY_READS = 10; const int LOOP_DELAY=30000; +extern const char *CARD_ROOT; + extern void jz_cpuspeed(unsigned clockspeed); enum color { diff --git a/src/selector.cpp b/src/selector.cpp index bd8db62..6f0c4ce 100644 --- a/src/selector.cpp +++ b/src/selector.cpp @@ -31,6 +31,7 @@ #include "linkapp.h" #include "selector.h" #include "filelister.h" +#include "gmenu2x.h" using namespace std; @@ -151,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") != 0 || p<4) { + if (p==string::npos || dir.compare(0, 5, CARD_ROOT) != 0 || p<4) { close = true; result = false; } else {