Skip to content

Commit

Permalink
engine: check for macOS bundle in SDL_GetBasePath, and fallback to SD…
Browse files Browse the repository at this point in the history
…L_GetPrefPath for our directory
  • Loading branch information
a1batross committed Jan 23, 2025
1 parent f0b29ba commit 7da9772
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions engine/common/filesystem_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 7da9772

Please sign in to comment.