mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 03:18:13 +00:00
storage: generic title storage allows override paths without '/' appended.
Fixes #11299.
This commit is contained in:
@@ -236,10 +236,15 @@ static const SDL_StorageInterface GENERIC_title_iface = {
|
||||
static SDL_Storage *GENERIC_Title_Create(const char *override, SDL_PropertiesID props)
|
||||
{
|
||||
SDL_Storage *result = NULL;
|
||||
|
||||
char *basepath = NULL;
|
||||
|
||||
if (override != NULL) {
|
||||
basepath = SDL_strdup(override);
|
||||
// make sure override has a path separator at the end. If you're not on Windows and used '\\', that's on you.
|
||||
const size_t slen = SDL_strlen(override);
|
||||
const bool need_sep = (!slen || ((override[slen-1] != '/') && (override[slen-1] != '\\')));
|
||||
if (SDL_asprintf(&basepath, "%s%s", override, need_sep ? "/" : "") == -1) {
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
const char *base = SDL_GetBasePath();
|
||||
basepath = base ? SDL_strdup(base) : NULL;
|
||||
|
Reference in New Issue
Block a user