Skip to content

Commit

Permalink
Fix #2062 Be more diligent about validating trailing "/" existence in…
Browse files Browse the repository at this point in the history
… HOME and XDG_DATA_HOME env vars
  • Loading branch information
urkle committed Aug 24, 2013
1 parent 58a558e commit e5b65e4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/filesystem/unix/SDL_sysfilesystem.c
Expand Up @@ -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;
Expand Down

0 comments on commit e5b65e4

Please sign in to comment.