diff --git a/anaglym.cc b/anaglym.cc index bf9ce6a..170d031 100644 --- a/anaglym.cc +++ b/anaglym.cc @@ -89,6 +89,20 @@ int main(int argc, char * argv[]) return -1; } + /* find the full path to the program */ + string engine_path = argv[0]; +#ifdef PLATFORM_LINUX + /* get the full path to the process using /proc/self/exe */ + char * buff = new char[10000]; + ssize_t bytes_read = readlink("/proc/self/exe", buff, 9999); + if (bytes_read > 0) + { + buff[bytes_read] = '\0'; + engine_path = buff; + } + delete[] buff; +#endif + dInitODE(); g_engine = new Engine(argv[0], av); if (g_engine->load(program))