engine: Make SDL_GetBasePath error not fatal
This commit is contained in:
parent
1bfb6c560a
commit
bee81e9723
1 changed files with 14 additions and 5 deletions
|
@ -1025,12 +1025,21 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
||||||
host.rootdir[0] = 0;
|
host.rootdir[0] = 0;
|
||||||
}
|
}
|
||||||
#elif (XASH_SDL == 2) && !XASH_NSWITCH // GetBasePath not impl'd in switch-sdl2
|
#elif (XASH_SDL == 2) && !XASH_NSWITCH // GetBasePath not impl'd in switch-sdl2
|
||||||
char *szBasePath;
|
char *szBasePath = SDL_GetBasePath();
|
||||||
|
if( szBasePath )
|
||||||
if( !( szBasePath = SDL_GetBasePath() ) )
|
{
|
||||||
|
Q_strncpy( host.rootdir, szBasePath, sizeof( host.rootdir ));
|
||||||
|
SDL_free( szBasePath );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if XASH_POSIX || XASH_WIN32
|
||||||
|
if( !getcwd( host.rootdir, sizeof( host.rootdir )))
|
||||||
|
Sys_Error( "couldn't determine current directory: %s, getcwd: %s", SDL_GetError(), strerror( errno ));
|
||||||
|
#else
|
||||||
Sys_Error( "couldn't determine current directory: %s", SDL_GetError() );
|
Sys_Error( "couldn't determine current directory: %s", SDL_GetError() );
|
||||||
Q_strncpy( host.rootdir, szBasePath, sizeof( host.rootdir ));
|
#endif
|
||||||
SDL_free( szBasePath );
|
}
|
||||||
#else
|
#else
|
||||||
if( !getcwd( host.rootdir, sizeof( host.rootdir )))
|
if( !getcwd( host.rootdir, sizeof( host.rootdir )))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue