forked from Green-Sky/tomato
Merge commit '852f2a6343518919e5ca8d3c1bbcab9f493e3cd8'
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@ -51,8 +51,7 @@ char *SDL_GetBasePath(void)
|
||||
|
||||
const size_t len = SDL_strlen(str);
|
||||
char *retval = (char *) SDL_malloc(len + 2);
|
||||
if (retval == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
if (!retval) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -70,11 +69,11 @@ char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
const char *append = "/config/settings/";
|
||||
size_t len = SDL_strlen(home);
|
||||
|
||||
if (app == NULL) {
|
||||
if (!app) {
|
||||
SDL_InvalidParamError("app");
|
||||
return NULL;
|
||||
}
|
||||
if (org == NULL) {
|
||||
if (!org) {
|
||||
org = "";
|
||||
}
|
||||
|
||||
@ -83,9 +82,7 @@ char *SDL_GetPrefPath(const char *org, const char *app)
|
||||
}
|
||||
len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3;
|
||||
char *retval = (char *) SDL_malloc(len);
|
||||
if (retval == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
} else {
|
||||
if (retval) {
|
||||
if (*org) {
|
||||
SDL_snprintf(retval, len, "%s%s%s/%s/", home, append, org, app);
|
||||
} else {
|
||||
@ -110,25 +107,17 @@ char *SDL_GetUserFolder(SDL_Folder folder)
|
||||
|
||||
switch (folder) {
|
||||
case SDL_FOLDER_HOME:
|
||||
retval = SDL_strdup(home);
|
||||
|
||||
if (!retval) {
|
||||
SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
return retval;
|
||||
return SDL_strdup(home);
|
||||
|
||||
/* TODO: Is Haiku's desktop folder always ~/Desktop/ ? */
|
||||
case SDL_FOLDER_DESKTOP:
|
||||
retval = (char *) SDL_malloc(SDL_strlen(home) + 10);
|
||||
|
||||
if (!retval) {
|
||||
SDL_OutOfMemory();
|
||||
if (retval) {
|
||||
SDL_strlcpy(retval, home, SDL_strlen(home) + 10);
|
||||
SDL_strlcat(retval, "/Desktop/", SDL_strlen(home) + 10);
|
||||
}
|
||||
|
||||
SDL_strlcpy(retval, home, SDL_strlen(home) + 10);
|
||||
SDL_strlcat(retval, "/Desktop/", SDL_strlen(home) + 10);
|
||||
|
||||
return retval;
|
||||
|
||||
case SDL_FOLDER_DOCUMENTS:
|
||||
|
Reference in New Issue
Block a user