Fix #2062 Be more diligent about validating trailing "/" existence in HOME and XDG_DATA_HOME env vars

--HG--
extra : amend_source : f857f2c2d14cf1fca0d5a5f4ca95c8acef79797e
This commit is contained in:
Edward Rudd 2013-08-24 09:05:18 -04:00
parent e94b620dc6
commit 455645d99a

View file

@ -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;
}
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;