Date:2010-08-03 17:32:54 (8 years 9 months ago)
Author:bartbes
Commit:ba9af53c21c10fe50e3fe7e17b3ba35e5f0fac08
Message:Changed the file browser to use / as root and added ability to see extensionless files (i.e. executables)

Files: src/browsedialog.cpp (2 diffs)
src/gmenu2x.cpp (3 diffs)
src/gmenu2x.h (1 diff)
src/selector.cpp (1 diff)

Change Details

src/browsedialog.cpp
4545        return false;
4646
4747    string path = fl->getPath();
48    if (path.empty() || !fileExists(path) || path.compare(0, 5, CARD_ROOT) != 0)
48    if (path.empty() || !fileExists(path) || path.compare(0, CARD_ROOT_LEN, CARD_ROOT) != 0)
4949        setPath(CARD_ROOT);
5050
5151    fl->browse();
...... 
166166
167167    if (p == path.size() - 1)
168168        p = path.rfind("/", p - 1);
169
170    if (p == string::npos || p < 4 || path.compare(0, 5, CARD_ROOT) != 0) {
169
170    if (p == string::npos || path.compare(0, CARD_ROOT_LEN, CARD_ROOT) != 0 || path.length() <= CARD_ROOT_LEN) {
171171        close = true;
172172        result = false;
173173    } else {
src/gmenu2x.cpp
7777//#include <pnd_discovery.h>
7878#endif
7979
80const char *CARD_ROOT = "/card";
80const char *CARD_ROOT = "/"; //Note: Add a trailing /!
81const int CARD_ROOT_LEN = 1;
8182
8283using namespace std;
8384using namespace fastdelegate;
...... 
10061007}
10071008
10081009void GMenu2X::explorer() {
1009    FileDialog fd(this,tr["Select an application"],".gpu,.dge,.sh");
1010    FileDialog fd(this,tr["Select an application"],".gpu,.dge,.sh,");
10101011    if (fd.exec()) {
10111012        if (confInt["saveSelection"] && (confInt["section"]!=menu->selSectionIndex() || confInt["link"]!=menu->selLinkIndex()))
10121013            writeConfig();
...... 
10631064        if (curGlobalVolume!=confInt["globalVolume"]) setVolume(confInt["globalVolume"]);
10641065        if (lang == "English") lang = "";
10651066        if (lang != tr.lang()) tr.setLang(lang);
1066        if (fileExists(CARD_ROOT) && !showRootFolder)
1067        /*if (fileExists(CARD_ROOT) && !showRootFolder)
10671068            unlink(CARD_ROOT);
10681069        else if (!fileExists(CARD_ROOT) && showRootFolder)
1069            symlink("/", CARD_ROOT);
1070            symlink("/", CARD_ROOT);*/
1071        //WARNING: Disabled because these functions get dangerous when run with / as CARD_ROOT
10701072        writeConfig();
10711073    }
10721074}
src/gmenu2x.h
4949const int LOOP_DELAY=30000;
5050
5151extern const char *CARD_ROOT;
52extern const int CARD_ROOT_LEN;
5253
5354extern void jz_cpuspeed(unsigned clockspeed);
5455
src/selector.cpp
152152        if ( gmenu2x->input[ACTION_X] ) {
153153            if (link->getSelectorBrowser()) {
154154                string::size_type p = dir.rfind("/", dir.size()-2);
155                if (p==string::npos || dir.compare(0, 5, CARD_ROOT) != 0 || p<4) {
155                if (p==string::npos || dir.compare(0, CARD_ROOT_LEN, CARD_ROOT) != 0 || dir.length() <= CARD_ROOT_LEN) {
156156                    close = true;
157157                    result = false;
158158                } else {

Archive Download the corresponding diff file



interactive