Support XDG base directory specification

This commit is contained in:
shmerl 2017-09-03 17:07:02 -04:00
parent e22837309b
commit d23864a3e2

View file

@ -104,7 +104,15 @@ const char* Sys_DefaultSavePath()
SDL_free( base_path );
}
#else
sprintf( savepath, "%s/.rbdoom3bfg", getenv( "HOME" ) );
const char* xdg_data_home = getenv( "XDG_DATA_HOME" );
if( xdg_data_home != NULL )
{
sprintf( savepath, "%s/rbdoom3bfg", xdg_data_home );
}
else
{
sprintf( savepath, "%s/.local/share/rbdoom3bfg", getenv( "HOME" ) );
}
#endif
return savepath.c_str();