From 6086e8d3845ae8f3b7e9b31b24240f46f0a5f40c Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Sat, 17 Jun 2017 22:30:09 +0200 Subject: [PATCH] haiku: Fixed missing slash in path from SDL_GetPrefPath(). --- src/filesystem/haiku/SDL_sysfilesystem.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/filesystem/haiku/SDL_sysfilesystem.cc b/src/filesystem/haiku/SDL_sysfilesystem.cc index 56ba4c339..d1b0a950b 100644 --- a/src/filesystem/haiku/SDL_sysfilesystem.cc +++ b/src/filesystem/haiku/SDL_sysfilesystem.cc @@ -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();