From 8b00b57468a7ec32f9735a53ca2664800593cf90 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 5 Apr 2026 01:08:07 -0400 Subject: [PATCH] filesystem: Rename a variable named "append" that is actually prepending. (Strictly speaking, this was probably meant to be an "append" to the home/base directory before the org/app name are appended to _that_, but it's definitely added to the absolute start of the string on Emscripten, so might as well make all of these match. Reference PR #15262. --- src/filesystem/emscripten/SDL_sysfilesystem.c | 10 +++++----- src/filesystem/haiku/SDL_sysfilesystem.cc | 10 +++++----- src/filesystem/unix/SDL_sysfilesystem.c | 14 +++++++------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/filesystem/emscripten/SDL_sysfilesystem.c b/src/filesystem/emscripten/SDL_sysfilesystem.c index 0d21cd2698..3156af5cd5 100644 --- a/src/filesystem/emscripten/SDL_sysfilesystem.c +++ b/src/filesystem/emscripten/SDL_sysfilesystem.c @@ -40,22 +40,22 @@ char *SDL_SYS_GetBasePath(void) char *SDL_SYS_GetPrefPath(const char *org, const char *app) { #ifdef SDL_EMSCRIPTEN_PERSISTENT_PATH_STRING - const char *append = SDL_EMSCRIPTEN_PERSISTENT_PATH_STRING; + const char *prepend = SDL_EMSCRIPTEN_PERSISTENT_PATH_STRING; #else - const char *append = "/libsdl"; + const char *prepend = "/libsdl"; #endif char *result; char *ptr = NULL; - const size_t len = SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 4; + const size_t len = SDL_strlen(prepend) + SDL_strlen(org) + SDL_strlen(app) + 4; result = (char *)SDL_malloc(len); if (!result) { return NULL; } if (*org) { - SDL_snprintf(result, len, "%s/%s/%s/", append, org, app); + SDL_snprintf(result, len, "%s/%s/%s/", prepend, org, app); } else { - SDL_snprintf(result, len, "%s/%s/", append, app); + SDL_snprintf(result, len, "%s/%s/", prepend, app); } for (ptr = result + 1; *ptr; ptr++) { diff --git a/src/filesystem/haiku/SDL_sysfilesystem.cc b/src/filesystem/haiku/SDL_sysfilesystem.cc index 380e05ce1e..48bfb1ed6a 100644 --- a/src/filesystem/haiku/SDL_sysfilesystem.cc +++ b/src/filesystem/haiku/SDL_sysfilesystem.cc @@ -69,19 +69,19 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app) { // !!! FIXME: is there a better way to do this? const char *home = SDL_getenv("HOME"); - const char *append = "/config/settings/"; + const char *prepend = "/config/settings/"; size_t len = SDL_strlen(home); if (!len || (home[len - 1] == '/')) { - ++append; // home empty or ends with separator, skip the one from append + ++prepend; // home empty or ends with separator, skip the one from prepend } - len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3; + len += SDL_strlen(prepend) + SDL_strlen(org) + SDL_strlen(app) + 3; char *result = (char *) SDL_malloc(len); if (result) { if (*org) { - SDL_snprintf(result, len, "%s%s%s/%s/", home, append, org, app); + SDL_snprintf(result, len, "%s%s%s/%s/", home, prepend, org, app); } else { - SDL_snprintf(result, len, "%s%s%s/", home, append, app); + SDL_snprintf(result, len, "%s%s%s/", home, prepend, app); } create_directory(result, 0700); // Haiku api: creates missing dirs } diff --git a/src/filesystem/unix/SDL_sysfilesystem.c b/src/filesystem/unix/SDL_sysfilesystem.c index 9edbf6dc0b..9cba8db2eb 100644 --- a/src/filesystem/unix/SDL_sysfilesystem.c +++ b/src/filesystem/unix/SDL_sysfilesystem.c @@ -266,7 +266,7 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app) * http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html */ const char *envr = SDL_getenv("XDG_DATA_HOME"); - const char *append; + const char *prepend; char *result = NULL; char *ptr = NULL; @@ -278,26 +278,26 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app) SDL_SetError("neither XDG_DATA_HOME nor HOME environment is set"); return NULL; } - append = "/.local/share/"; + prepend = "/.local/share/"; } else { - append = "/"; + prepend = "/"; } size_t len = SDL_strlen(envr); if (envr[len - 1] == '/') { - append += 1; + prepend += 1; } - len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3; + len += SDL_strlen(prepend) + SDL_strlen(org) + SDL_strlen(app) + 3; result = (char *)SDL_malloc(len); if (!result) { return NULL; } if (*org) { - (void)SDL_snprintf(result, len, "%s%s%s/%s/", envr, append, org, app); + (void)SDL_snprintf(result, len, "%s%s%s/%s/", envr, prepend, org, app); } else { - (void)SDL_snprintf(result, len, "%s%s%s/", envr, append, app); + (void)SDL_snprintf(result, len, "%s%s%s/", envr, prepend, app); } for (ptr = result + 1; *ptr; ptr++) {