Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/physfs_platform_sdl3.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,13 @@ char *__PHYSFS_platformCalcUserDir(void)

char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app)
{
char *out = SDL_GetPrefPath(org, app);
BAIL_IF(out == NULL, PHYSFS_ERR_OS_ERROR, NULL);
/* Unlike SDL_GetBasePath() or SDL_GetUserFolder(), SDL_GetPrefPath() allocates the string for us. */
char *out;
char *pref = SDL_GetPrefPath(org, app);
BAIL_IF(pref == NULL, PHYSFS_ERR_OS_ERROR, NULL);
/* SDL_GetPrefPath() expects SDL_free(), which may be different than PhysFS's allocator. Use __PHYSFS_strdup() to be safe. */
out = __PHYSFS_strdup(pref);
SDL_free(pref);
BAIL_IF(!out, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
return out;
} /* __PHYSFS_platformCalcPrefDir */

Expand Down
Loading