filesystem: SDL_EnumerateDirectory() gives dirs with path seperators appended.

Fixes #11065.
Fixes #11427.
This commit is contained in:
Ryan C. Gordon committed 2025-01-16 08:19:28 -05:00
1 parent e98ee9bb04
commit 87e1b0eb89
5 files changed
+54 -29

No files matched your search

+1 -8
View File
@@ -20,14 +20,7 @@ static SDL_EnumerationResult SDLCALL enum_callback(void *userdata, const char *o
SDL_PathInfo info;
char *fullpath = NULL;
/* you can use '/' for a path separator on Windows, but to make the log output look correct, we'll #ifdef this... */
#ifdef SDL_PLATFORM_WINDOWS
const char *pathsep = "\\";
#else
const char *pathsep = "/";
#endif
if (SDL_asprintf(&fullpath, "%s%s%s", origdir, *origdir ? pathsep : "", fname) < 0) {
if (SDL_asprintf(&fullpath, "%s%s", origdir, fname) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!");
return SDL_ENUM_FAILURE;
}