find full path to engine in linux using /proc/self/exe
This commit is contained in:
parent
9e6bb1b22d
commit
4d726dbf62
14
anaglym.cc
14
anaglym.cc
@ -89,6 +89,20 @@ int main(int argc, char * argv[])
|
|||||||
return -1;
|
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();
|
dInitODE();
|
||||||
g_engine = new Engine(argv[0], av);
|
g_engine = new Engine(argv[0], av);
|
||||||
if (g_engine->load(program))
|
if (g_engine->load(program))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user