From cca367745b2de67820194a6684bab2aa0c34b1fb Mon Sep 17 00:00:00 2001 From: Ayla Date: Sun, 18 Sep 2011 12:42:08 +0200 Subject: [PATCH] Dingux port: The SD card root is now hardcoded to /boot for the getDiskFree() function only. That function was not working as CARD_ROOT does not necessarily point to the mount point of a filesystem. --- src/gmenu2x.cpp | 11 ++++++++--- src/gmenu2x.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index 3992478..a56671f 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -456,7 +456,12 @@ void GMenu2X::initBG() { Surface *sd = Surface::loadImage("imgs/sd.png", confStr["skin"]); if (sd) sd->blit(bgmain, 3, bottomBarIconY); - string df = getDiskFree(); + +#ifdef PLATFORM_DINGUX + string df = getDiskFree("/boot"); +#else + string df = getDiskFree(CARD_ROOT); +#endif bgmain->write(font, df, 22, bottomBarTextY, ASFont::HAlignLeft, ASFont::VAlignMiddle); delete sd; @@ -2137,12 +2142,12 @@ const string &GMenu2X::getExePath() { return path; } -string GMenu2X::getDiskFree() { +string GMenu2X::getDiskFree(const char *path) { stringstream ss; string df = ""; struct statvfs b; - int ret = statvfs(CARD_ROOT, &b); + int ret = statvfs(path, &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 07a0221..62541f7 100644 --- a/src/gmenu2x.h +++ b/src/gmenu2x.h @@ -102,7 +102,7 @@ private: Retrieves the free disk space on the sd @return String containing a human readable representation of the free disk space */ - string getDiskFree(); + string getDiskFree(const char *path); unsigned short cpuX; //!< Offset for displaying cpu clock information unsigned short volumeX; //!< Offset for displaying volume level unsigned short manualX; //!< Offset for displaying the manual indicator in the taskbar