Remove extra path separator in GetNearbyFilename

This commit is contained in:
Cameron Cawley 2022-05-19 22:54:23 +01:00 committed by Sam Lantinga
parent 9edd411a83
commit d2b5965894
1 changed files with 2 additions and 10 deletions

View File

@ -6,14 +6,6 @@ SPDX-License-Identifier: Zlib
#include "testutils.h" #include "testutils.h"
#if defined(SDL_FILESYSTEM_OS2) || defined(SDL_FILESYSTEM_WINDOWS)
static const char pathsep[] = "\\";
#elif defined(SDL_FILESYSTEM_RISCOS)
static const char pathsep[] = ".";
#else
static const char pathsep[] = "/";
#endif
/* /*
* Return the absolute path to def in the SDL_GetBasePath() if possible, or * Return the absolute path to def in the SDL_GetBasePath() if possible, or
* the relative path to def on platforms that don't have a working * the relative path to def on platforms that don't have a working
@ -31,7 +23,7 @@ GetNearbyFilename(const char *file)
if (base != NULL) { if (base != NULL) {
SDL_RWops *rw; SDL_RWops *rw;
size_t len = SDL_strlen(base) + SDL_strlen(pathsep) + SDL_strlen(file) + 1; size_t len = SDL_strlen(base) + SDL_strlen(file) + 1;
path = SDL_malloc(len); path = SDL_malloc(len);
@ -41,7 +33,7 @@ GetNearbyFilename(const char *file)
return NULL; return NULL;
} }
SDL_snprintf(path, len, "%s%s%s", base, pathsep, file); SDL_snprintf(path, len, "%s%s", base, file);
SDL_free(base); SDL_free(base);
rw = SDL_RWFromFile(path, "rb"); rw = SDL_RWFromFile(path, "rb");