Skip to content

Commit

Permalink
haiku: Fixed missing slash in path from SDL_GetPrefPath().
Browse files Browse the repository at this point in the history
  • Loading branch information
philippwiesemann committed Jun 17, 2017
1 parent 0b750cd commit 6086e8d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/filesystem/haiku/SDL_sysfilesystem.cc
Expand Up @@ -75,8 +75,12 @@ SDL_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 size_t len = SDL_strlen(home) + SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3;
const char *append = "/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
}
len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3;
char *retval = (char *) SDL_malloc(len);
if (!retval) {
SDL_OutOfMemory();
Expand Down

0 comments on commit 6086e8d

Please sign in to comment.