Skip to content

Commit 8b00b57

Browse files
committed
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.
1 parent 19f7028 commit 8b00b57

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

src/filesystem/emscripten/SDL_sysfilesystem.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,22 @@ char *SDL_SYS_GetBasePath(void)
4040
char *SDL_SYS_GetPrefPath(const char *org, const char *app)
4141
{
4242
#ifdef SDL_EMSCRIPTEN_PERSISTENT_PATH_STRING
43-
const char *append = SDL_EMSCRIPTEN_PERSISTENT_PATH_STRING;
43+
const char *prepend = SDL_EMSCRIPTEN_PERSISTENT_PATH_STRING;
4444
#else
45-
const char *append = "/libsdl";
45+
const char *prepend = "/libsdl";
4646
#endif
4747
char *result;
4848
char *ptr = NULL;
49-
const size_t len = SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 4;
49+
const size_t len = SDL_strlen(prepend) + SDL_strlen(org) + SDL_strlen(app) + 4;
5050
result = (char *)SDL_malloc(len);
5151
if (!result) {
5252
return NULL;
5353
}
5454

5555
if (*org) {
56-
SDL_snprintf(result, len, "%s/%s/%s/", append, org, app);
56+
SDL_snprintf(result, len, "%s/%s/%s/", prepend, org, app);
5757
} else {
58-
SDL_snprintf(result, len, "%s/%s/", append, app);
58+
SDL_snprintf(result, len, "%s/%s/", prepend, app);
5959
}
6060

6161
for (ptr = result + 1; *ptr; ptr++) {

src/filesystem/haiku/SDL_sysfilesystem.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,19 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
6969
{
7070
// !!! FIXME: is there a better way to do this?
7171
const char *home = SDL_getenv("HOME");
72-
const char *append = "/config/settings/";
72+
const char *prepend = "/config/settings/";
7373
size_t len = SDL_strlen(home);
7474

7575
if (!len || (home[len - 1] == '/')) {
76-
++append; // home empty or ends with separator, skip the one from append
76+
++prepend; // home empty or ends with separator, skip the one from prepend
7777
}
78-
len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3;
78+
len += SDL_strlen(prepend) + SDL_strlen(org) + SDL_strlen(app) + 3;
7979
char *result = (char *) SDL_malloc(len);
8080
if (result) {
8181
if (*org) {
82-
SDL_snprintf(result, len, "%s%s%s/%s/", home, append, org, app);
82+
SDL_snprintf(result, len, "%s%s%s/%s/", home, prepend, org, app);
8383
} else {
84-
SDL_snprintf(result, len, "%s%s%s/", home, append, app);
84+
SDL_snprintf(result, len, "%s%s%s/", home, prepend, app);
8585
}
8686
create_directory(result, 0700); // Haiku api: creates missing dirs
8787
}

src/filesystem/unix/SDL_sysfilesystem.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
266266
* http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
267267
*/
268268
const char *envr = SDL_getenv("XDG_DATA_HOME");
269-
const char *append;
269+
const char *prepend;
270270
char *result = NULL;
271271
char *ptr = NULL;
272272

@@ -278,26 +278,26 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
278278
SDL_SetError("neither XDG_DATA_HOME nor HOME environment is set");
279279
return NULL;
280280
}
281-
append = "/.local/share/";
281+
prepend = "/.local/share/";
282282
} else {
283-
append = "/";
283+
prepend = "/";
284284
}
285285

286286
size_t len = SDL_strlen(envr);
287287
if (envr[len - 1] == '/') {
288-
append += 1;
288+
prepend += 1;
289289
}
290290

291-
len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3;
291+
len += SDL_strlen(prepend) + SDL_strlen(org) + SDL_strlen(app) + 3;
292292
result = (char *)SDL_malloc(len);
293293
if (!result) {
294294
return NULL;
295295
}
296296

297297
if (*org) {
298-
(void)SDL_snprintf(result, len, "%s%s%s/%s/", envr, append, org, app);
298+
(void)SDL_snprintf(result, len, "%s%s%s/%s/", envr, prepend, org, app);
299299
} else {
300-
(void)SDL_snprintf(result, len, "%s%s%s/", envr, append, app);
300+
(void)SDL_snprintf(result, len, "%s%s%s/", envr, prepend, app);
301301
}
302302

303303
for (ptr = result + 1; *ptr; ptr++) {

0 commit comments

Comments
 (0)