filesystem: SDL_GetPrefPath() now follows the SDL_GetStringRule.

Reference Issue #10229.
This commit is contained in:
Ryan C. Gordon
2024-07-15 20:21:22 -04:00
parent 2321726ff1
commit 52bf7ff42d
20 changed files with 35 additions and 26 deletions

View File

@@ -225,15 +225,18 @@ static const SDL_StorageInterface GENERIC_user_iface = {
static SDL_Storage *GENERIC_User_Create(const char *org, const char *app, SDL_PropertiesID props)
{
SDL_Storage *result;
char *prefpath = SDL_GetPrefPath(org, app);
char *prefpath = NULL;
const char *sdlprefpath = SDL_GetPrefPath(org, app);
if (sdlprefpath) {
prefpath = SDL_strdup(sdlprefpath);
}
if (prefpath == NULL) {
return NULL;
}
result = SDL_OpenStorage(&GENERIC_user_iface, prefpath);
if (result == NULL) {
SDL_free(prefpath);
SDL_free(prefpath); // otherwise CloseStorage will free it.
}
return result;
}