From 1241523105c31488741086f0532e7da83e2050ad Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Sun, 24 Jun 2012 23:19:45 +0200 Subject: [PATCH] Removed variable/function to get the directory of the executable. The application shouldn't care from which directory it is being executed. --- src/gmenu2x.cpp | 18 ------------------ src/gmenu2x.h | 9 --------- src/linkapp.cpp | 2 -- 3 files changed, 29 deletions(-) diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index 8d95029..4047f14 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -255,9 +255,6 @@ GMenu2X::GMenu2X() bottomBarIconY = resY-18; bottomBarTextY = resY-10; - path = ""; - getExePath(); - #ifdef UNLOCK_VT unlockVT(); #endif @@ -839,7 +836,6 @@ void GMenu2X::explorer() { if (confInt["saveSelection"] && (confInt["section"]!=menu->selSectionIndex() || confInt["link"]!=menu->selLinkIndex())) writeConfig(); - //string command = cmdclean(fd.path()+"/"+fd.file) + "; sync & cd "+cmdclean(getExePath())+"; exec ./gmenu2x"; string command = cmdclean(fd.getPath()+"/"+fd.getFile()); chdir(fd.getPath().c_str()); quit(); @@ -1483,20 +1479,6 @@ void GMenu2X::setClock(unsigned mhz) { #endif } -const string &GMenu2X::getExePath() { - if (path.empty()) { - char buf[255]; - memset(buf, 0, 255); - int l = readlink("/proc/self/exe", buf, 255); - - path = buf; - path = path.substr(0,l); - l = path.rfind("/"); - path = path.substr(0,l+1); - } - return path; -} - string GMenu2X::getDiskFree(const char *path) { stringstream ss; string df = ""; diff --git a/src/gmenu2x.h b/src/gmenu2x.h index e8b8a87..6fb2542 100644 --- a/src/gmenu2x.h +++ b/src/gmenu2x.h @@ -65,7 +65,6 @@ typedef std::tr1::unordered_map > class GMenu2X { private: Touchscreen ts; - std::string path; //!< Contains the working directory of GMenu2X /*! Retrieves the free disk space on the sd @@ -134,14 +133,6 @@ public: uint resX, resY, halfX, halfY; uint bottomBarIconY, bottomBarTextY, linkColumns, linkRows; - /*! - Retrieves the parent directory of GMenu2X. - This functions is used to initialize the "path" variable. - @see path - @return String containing the parent directory - */ - const std::string &getExePath(); - InputManager input; //Configuration hashes diff --git a/src/linkapp.cpp b/src/linkapp.cpp index 541ba6e..54e3b5a 100644 --- a/src/linkapp.cpp +++ b/src/linkapp.cpp @@ -464,8 +464,6 @@ void LinkApp::launch(const string &selectedFile, const string &selectedDir) { //try relaunching gmenu2x gmenu2x->main(); } - - chdir(gmenu2x->getExePath().c_str()); } const string &LinkApp::getExec() {