Lines 1000-1024
Link Here
|
1000 |
debugLog(path); |
1000 |
debugLog(path); |
1001 |
chdir(path); |
1001 |
chdir(path); |
1002 |
#elif defined(BBGE_BUILD_UNIX) |
1002 |
#elif defined(BBGE_BUILD_UNIX) |
1003 |
char path[PATH_MAX]; |
1003 |
std::string path("/usr/share/games/"); |
1004 |
// always a symlink to this process's binary, on modern Linux systems. |
1004 |
path.append(appName); |
1005 |
const ssize_t rc = readlink("/proc/self/exe", path, sizeof (path)); |
1005 |
debugLog(path); |
1006 |
if ( (rc == -1) || (rc >= sizeof (path)) ) |
1006 |
chdir(path.c_str()); |
1007 |
{ |
|
|
1008 |
// error! |
1009 |
debugLog("readlink"); |
1010 |
} |
1011 |
else |
1012 |
{ |
1013 |
path[rc] = '\0'; |
1014 |
char *ptr = strrchr(path, '/'); |
1015 |
if (ptr != NULL) |
1016 |
{ |
1017 |
*ptr = '\0'; |
1018 |
debugLog(path); |
1019 |
chdir(path); |
1020 |
} |
1021 |
} |
1022 |
#endif |
1007 |
#endif |
1023 |
#ifdef BBGE_BUILD_WINDOWS |
1008 |
#ifdef BBGE_BUILD_WINDOWS |
1024 |
#endif |
1009 |
#endif |