mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-16 03:08:01 +00:00
Fix #2062 Be more diligent about validating trailing "/" existence in HOME and XDG_DATA_HOME env vars
This commit is contained in:
parent
9bc89f40b9
commit
8d164f06ea
1 changed files with 9 additions and 1 deletions
|
|
@ -173,7 +173,15 @@ SDL_GetPrefPath(const char *org, const char *app)
|
|||
SDL_SetError("neither XDG_DATA_HOME nor HOME environment is set");
|
||||
return NULL;
|
||||
}
|
||||
append = ".local/share/";
|
||||
if (envr[SDL_strlen(envr) - 1] == '/') {
|
||||
append = ".local/share/";
|
||||
} else {
|
||||
append = "/.local/share/";
|
||||
}
|
||||
} else {
|
||||
if (envr[SDL_strlen(envr) - 1] == '/') {
|
||||
append = "";
|
||||
}
|
||||
} /* if */
|
||||
|
||||
len = SDL_strlen(envr) + SDL_strlen(append) + SDL_strlen(app) + 2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue