Date: | 2012-06-24 23:19:45 (11 years 9 months ago) |
---|---|
Author: | Paul Cercueil |
Commit: | 1241523105c31488741086f0532e7da83e2050ad |
Message: | Removed variable/function to get the directory of the executable. The application shouldn't care from which directory it is being executed. |
Files: |
src/gmenu2x.cpp (3 diffs) src/gmenu2x.h (2 diffs) src/linkapp.cpp (1 diff) |
Change Details
src/gmenu2x.cpp | ||
---|---|---|
255 | 255 | bottomBarIconY = resY-18; |
256 | 256 | bottomBarTextY = resY-10; |
257 | 257 | |
258 | path = ""; | |
259 | getExePath(); | |
260 | ||
261 | 258 | #ifdef UNLOCK_VT |
262 | 259 | unlockVT(); |
263 | 260 | #endif |
... | ... | |
839 | 836 | if (confInt["saveSelection"] && (confInt["section"]!=menu->selSectionIndex() || confInt["link"]!=menu->selLinkIndex())) |
840 | 837 | writeConfig(); |
841 | 838 | |
842 | //string command = cmdclean(fd.path()+"/"+fd.file) + "; sync & cd "+cmdclean(getExePath())+"; exec ./gmenu2x"; | |
843 | 839 | string command = cmdclean(fd.getPath()+"/"+fd.getFile()); |
844 | 840 | chdir(fd.getPath().c_str()); |
845 | 841 | quit(); |
... | ... | |
1483 | 1479 | #endif |
1484 | 1480 | } |
1485 | 1481 | |
1486 | const string &GMenu2X::getExePath() { | |
1487 | if (path.empty()) { | |
1488 | char buf[255]; | |
1489 | memset(buf, 0, 255); | |
1490 | int l = readlink("/proc/self/exe", buf, 255); | |
1491 | ||
1492 | path = buf; | |
1493 | path = path.substr(0,l); | |
1494 | l = path.rfind("/"); | |
1495 | path = path.substr(0,l+1); | |
1496 | } | |
1497 | return path; | |
1498 | } | |
1499 | ||
1500 | 1482 | string GMenu2X::getDiskFree(const char *path) { |
1501 | 1483 | stringstream ss; |
1502 | 1484 | string df = ""; |
src/gmenu2x.h | ||
---|---|---|
65 | 65 | class GMenu2X { |
66 | 66 | private: |
67 | 67 | Touchscreen ts; |
68 | std::string path; //!< Contains the working directory of GMenu2X | |
69 | 68 | |
70 | 69 | /*! |
71 | 70 | Retrieves the free disk space on the sd |
... | ... | |
134 | 133 | uint resX, resY, halfX, halfY; |
135 | 134 | uint bottomBarIconY, bottomBarTextY, linkColumns, linkRows; |
136 | 135 | |
137 | /*! | |
138 | Retrieves the parent directory of GMenu2X. | |
139 | This functions is used to initialize the "path" variable. | |
140 | @see path | |
141 | @return String containing the parent directory | |
142 | */ | |
143 | const std::string &getExePath(); | |
144 | ||
145 | 136 | InputManager input; |
146 | 137 | |
147 | 138 | //Configuration hashes |
src/linkapp.cpp | ||
---|---|---|
464 | 464 | //try relaunching gmenu2x |
465 | 465 | gmenu2x->main(); |
466 | 466 | } |
467 | ||
468 | chdir(gmenu2x->getExePath().c_str()); | |
469 | 467 | } |
470 | 468 | |
471 | 469 | const string &LinkApp::getExec() { |
Branches:
install_locations
master
opkrun
packages