Lines 1008-1032
Link Here
|
1008 |
else |
1008 |
else |
1009 |
debugLog("Failed to chdir to filesystem path" + filesystem); |
1009 |
debugLog("Failed to chdir to filesystem path" + filesystem); |
1010 |
} |
1010 |
} |
1011 |
char path[PATH_MAX]; |
1011 |
std::string path("/usr/share/games/"); |
1012 |
// always a symlink to this process's binary, on modern Linux systems. |
1012 |
path.append(appName); |
1013 |
const ssize_t rc = readlink("/proc/self/exe", path, sizeof (path)); |
1013 |
debugLog(path); |
1014 |
if ( (rc == -1) || (rc >= sizeof (path)) ) |
1014 |
chdir(path.c_str()); |
1015 |
{ |
|
|
1016 |
// error! |
1017 |
debugLog("readlink"); |
1018 |
} |
1019 |
else |
1020 |
{ |
1021 |
path[rc] = '\0'; |
1022 |
char *ptr = strrchr(path, '/'); |
1023 |
if (ptr != NULL) |
1024 |
{ |
1025 |
*ptr = '\0'; |
1026 |
debugLog(path); |
1027 |
chdir(path); |
1028 |
} |
1029 |
} |
1030 |
#endif |
1015 |
#endif |
1031 |
#ifdef BBGE_BUILD_WINDOWS |
1016 |
#ifdef BBGE_BUILD_WINDOWS |
1032 |
// FIXME: filesystem not handled |
1017 |
// FIXME: filesystem not handled |