From 04d9d9322d965e30d4bb02e45dc6ce02c5c3fd53 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Fri, 19 Jul 2013 11:54:09 -0400 Subject: [PATCH] Remove trailing slash from CARD_ROOT --- src/browsedialog.cpp | 3 ++- src/gmenu2x.cpp | 7 +++---- src/gmenu2x.h | 1 - src/menu.cpp | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/browsedialog.cpp b/src/browsedialog.cpp index c8cbc60..05e0e36 100644 --- a/src/browsedialog.cpp +++ b/src/browsedialog.cpp @@ -53,7 +53,8 @@ bool BrowseDialog::exec() return false; 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); fl->browse(); diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index 0386f83..04e109c 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -95,11 +95,10 @@ using namespace fastdelegate; #ifdef _CARD_ROOT const char *CARD_ROOT = _CARD_ROOT; #elif defined(PLATFORM_A320) || defined(PLATFORM_GCW0) -const char *CARD_ROOT = "/media/"; +const char *CARD_ROOT = "/media"; #else -const char *CARD_ROOT = "/card/"; //Note: Add a trailing /! +const char *CARD_ROOT = "/card"; #endif -const int CARD_ROOT_LEN = strlen(CARD_ROOT)-1; static GMenu2X *app; static string gmenu2x_home; @@ -614,7 +613,7 @@ void GMenu2X::main() { btnContextMenu.setAction(MakeDelegate(this, &GMenu2X::contextMenu)); if (!fileExists(CARD_ROOT)) - CARD_ROOT = "/"; + CARD_ROOT = ""; while (!quit) { tickNow = SDL_GetTicks(); diff --git a/src/gmenu2x.h b/src/gmenu2x.h index f23c879..0b50f88 100644 --- a/src/gmenu2x.h +++ b/src/gmenu2x.h @@ -45,7 +45,6 @@ class Surface; const int LOOP_DELAY = 30000; extern const char *CARD_ROOT; -extern const int CARD_ROOT_LEN; // Note: Keep this in sync with colorNames! enum color { diff --git a/src/menu.cpp b/src/menu.cpp index 00527a5..c6c021b 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -63,7 +63,7 @@ Menu::Menu(GMenu2X *gmenu2x, Touchscreen &ts) if (dptr->d_type != DT_DIR) 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)) continue;