mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-30 23:18:29 +00:00
filesystem: Check SDL_GetPrefPath parameters at the higher level.
...so the backends don't have to do it. Also added a stern warning about `org` being omitted, but leaving it as allowed so as not to break existing apps (more than they are already broken, at least). Fixes #13322.
This commit is contained in:
@@ -155,23 +155,14 @@ char *SDL_SYS_GetBasePath(void)
|
||||
char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
{
|
||||
char *canon, *dir, *result;
|
||||
size_t len;
|
||||
_kernel_oserror *error;
|
||||
|
||||
if (!app) {
|
||||
SDL_InvalidParamError("app");
|
||||
return NULL;
|
||||
}
|
||||
if (!org) {
|
||||
org = "";
|
||||
}
|
||||
|
||||
canon = canonicalisePath("<Choices$Write>", "Run$Path");
|
||||
if (!canon) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
len = SDL_strlen(canon) + SDL_strlen(org) + SDL_strlen(app) + 4;
|
||||
const size_t len = SDL_strlen(canon) + SDL_strlen(org) + SDL_strlen(app) + 4;
|
||||
dir = (char *)SDL_malloc(len);
|
||||
if (!dir) {
|
||||
SDL_free(canon);
|
||||
|
Reference in New Issue
Block a user