mirror of
https://github.com/nillerusr/source-engine.git
synced 2024-12-21 21:56:50 +00:00
launcher_main: automatically set LD_LIBRARY_PATH on launch
This commit is contained in:
parent
54f174d262
commit
2dca8fd6c7
@ -216,6 +216,25 @@ static void WaitForDebuggerConnect( int argc, char *argv[], int time )
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
char ld_path[4196];
|
||||
char *path = "bin/";
|
||||
char *ld_env;
|
||||
|
||||
if( (ld_env = getenv("LD_LIBRARY_PATH")) != NULL )
|
||||
{
|
||||
snprintf(ld_path, sizeof(ld_path), "%s:bin/", ld_env);
|
||||
path = ld_path;
|
||||
}
|
||||
|
||||
setenv("LD_LIBRARY_PATH", path, 1);
|
||||
|
||||
extern char** environ;
|
||||
if( getenv("NO_EXECVE_AGAIN") == NULL )
|
||||
{
|
||||
setenv("NO_EXECVE_AGAIN", "1", 1);
|
||||
execve(argv[0], argv, environ);
|
||||
}
|
||||
|
||||
void *launcher = dlopen( "bin/liblauncher" DLL_EXT_STRING, RTLD_NOW );
|
||||
if ( !launcher )
|
||||
fprintf( stderr, "%s\nFailed to load the launcher\n", dlerror() );
|
||||
|
Loading…
Reference in New Issue
Block a user