1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-10-05 22:53:15 +03:00

Remove trailing slash from CARD_ROOT

This commit is contained in:
Paul Cercueil 2013-07-19 11:54:09 -04:00
parent 0264b724d6
commit 04d9d9322d
4 changed files with 6 additions and 7 deletions

View File

@ -53,7 +53,8 @@ bool BrowseDialog::exec()
return false; return false;
string path = fl->getPath(); string path = fl->getPath();
if (path.empty() || !fileExists(path) || path.compare(0, CARD_ROOT_LEN, CARD_ROOT) != 0) if (path.empty() || !fileExists(path) || path.compare(0,
strlen(CARD_ROOT), CARD_ROOT) != 0)
setPath(CARD_ROOT); setPath(CARD_ROOT);
fl->browse(); fl->browse();

View File

@ -95,11 +95,10 @@ using namespace fastdelegate;
#ifdef _CARD_ROOT #ifdef _CARD_ROOT
const char *CARD_ROOT = _CARD_ROOT; const char *CARD_ROOT = _CARD_ROOT;
#elif defined(PLATFORM_A320) || defined(PLATFORM_GCW0) #elif defined(PLATFORM_A320) || defined(PLATFORM_GCW0)
const char *CARD_ROOT = "/media/"; const char *CARD_ROOT = "/media";
#else #else
const char *CARD_ROOT = "/card/"; //Note: Add a trailing /! const char *CARD_ROOT = "/card";
#endif #endif
const int CARD_ROOT_LEN = strlen(CARD_ROOT)-1;
static GMenu2X *app; static GMenu2X *app;
static string gmenu2x_home; static string gmenu2x_home;
@ -614,7 +613,7 @@ void GMenu2X::main() {
btnContextMenu.setAction(MakeDelegate(this, &GMenu2X::contextMenu)); btnContextMenu.setAction(MakeDelegate(this, &GMenu2X::contextMenu));
if (!fileExists(CARD_ROOT)) if (!fileExists(CARD_ROOT))
CARD_ROOT = "/"; CARD_ROOT = "";
while (!quit) { while (!quit) {
tickNow = SDL_GetTicks(); tickNow = SDL_GetTicks();

View File

@ -45,7 +45,6 @@ class Surface;
const int LOOP_DELAY = 30000; const int LOOP_DELAY = 30000;
extern const char *CARD_ROOT; extern const char *CARD_ROOT;
extern const int CARD_ROOT_LEN;
// Note: Keep this in sync with colorNames! // Note: Keep this in sync with colorNames!
enum color { enum color {

View File

@ -63,7 +63,7 @@ Menu::Menu(GMenu2X *gmenu2x, Touchscreen &ts)
if (dptr->d_type != DT_DIR) if (dptr->d_type != DT_DIR)
continue; continue;
string path = (string) CARD_ROOT + dptr->d_name + "/apps"; string path = (string) CARD_ROOT + "/" + dptr->d_name + "/apps";
if (access(path.c_str(), F_OK)) if (access(path.c_str(), F_OK))
continue; continue;