mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-12-28 05:59:53 +02:00
Changed the file browser to use / as root and added ability to see extensionless files (i.e. executables)
This commit is contained in:
parent
b54a595e26
commit
ba9af53c21
@ -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 {
|
||||
|
@ -77,7 +77,8 @@
|
||||
//#include <pnd_discovery.h>
|
||||
#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();
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user