storage: deal with paths with Windows '\\' path separators appended.

Reference Issue #11986.
This commit is contained in:
Ryan C. Gordon
2025-01-17 20:02:59 -05:00
parent 7c6adc1ca7
commit a6a8598b98

View File

@@ -327,7 +327,12 @@ SDL_Storage *GENERIC_OpenFileStorage(const char *path)
len += SDL_strlen(path);
}
if (len > 0) {
if (path[len-1] == '/') {
#ifdef SDL_PLATFORM_WINDOWS
const bool appended_separator = (path[len-1] == '/') || (path[len-1] == '\\');
#else
const bool appended_separator = (path[len-1] == '/');
#endif
if (appended_separator) {
basepath = SDL_strdup(path);
if (!basepath) {
return NULL;