mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 15:21:35 +00:00
* Lets try that again
This commit is contained in:
parent
a99e721711
commit
0f8c7da187
1 changed files with 12 additions and 26 deletions
|
@ -1346,38 +1346,24 @@ to symlink to binaries and /not/ have the links resolved.
|
||||||
*/
|
*/
|
||||||
char *Sys_BinName( const char *arg0 )
|
char *Sys_BinName( const char *arg0 )
|
||||||
{
|
{
|
||||||
#ifdef NDEBUG
|
|
||||||
int n;
|
|
||||||
char src[ PATH_MAX ];
|
|
||||||
char dir[ PATH_MAX ];
|
|
||||||
qboolean links = qfalse;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static char dst[ PATH_MAX ];
|
static char dst[ PATH_MAX ];
|
||||||
|
|
||||||
Q_strncpyz( dst, arg0, PATH_MAX );
|
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
while( ( n = readlink( dst, src, PATH_MAX ) ) >= 0 )
|
|
||||||
{
|
|
||||||
src[ n ] = '\0';
|
|
||||||
|
|
||||||
Q_strncpyz( dir, dirname( dst ), PATH_MAX );
|
#ifdef __linux__
|
||||||
Q_strncpyz( dst, dir, PATH_MAX );
|
int n = readlink( "/proc/self/exe", dst, PATH_MAX - 1 );
|
||||||
Q_strcat( dst, PATH_MAX, "/" );
|
|
||||||
Q_strcat( dst, PATH_MAX, src );
|
|
||||||
|
|
||||||
links = qtrue;
|
if( n >= 0 && n < PATH_MAX )
|
||||||
}
|
dst[ n ] = '\0';
|
||||||
|
else
|
||||||
|
Q_strncpyz( dst, arg0, PATH_MAX );
|
||||||
|
#else
|
||||||
|
#warning Sys_BinName not implemented
|
||||||
|
Q_strncpyz( dst, arg0, PATH_MAX );
|
||||||
|
#endif
|
||||||
|
|
||||||
if( links )
|
#else
|
||||||
{
|
Q_strncpyz( dst, arg0, PATH_MAX );
|
||||||
Q_strncpyz( dst, Sys_Cwd( ), PATH_MAX );
|
|
||||||
Q_strcat( dst, PATH_MAX, "/" );
|
|
||||||
Q_strcat( dst, PATH_MAX, dir );
|
|
||||||
Q_strcat( dst, PATH_MAX, "/" );
|
|
||||||
Q_strcat( dst, PATH_MAX, src );
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return dst;
|
return dst;
|
||||||
|
|
Loading…
Reference in a new issue