engine: check for macOS bundle in SDL_GetBasePath, and fallback to SDL_GetPrefPath for our directory

This commit is contained in:
Alibek Omarov 2025-01-23 22:57:11 +03:00
parent f0b29bac1b
commit 7da9772143

View file

@ -186,15 +186,20 @@ static qboolean FS_DetermineRootDirectory( char *out, size_t size )
Sys_Error( "couldn't find %s data directory", XASH_ENGINE_NAME );
return false;
#elif ( XASH_SDL == 2 ) && !XASH_NSWITCH // GetBasePath not impl'd in switch-sdl2
#if XASH_APPLE
path = SDL_GetPrefPath( NULL, XASH_ENGINE_NAME );
#else
path = SDL_GetBasePath();
#if XASH_APPLE
if( path != NULL && Q_stristr( path, ".app" ))
{
SDL_free((void *)path );
path = SDL_GetPrefPath( NULL, XASH_ENGINE_NAME );
}
#endif
if( path != NULL )
{
Q_strncpy( out, path, size );
SDL_free(( void *)path );
SDL_free((void *)path );
return true;
}