SDL_EnumerateDirectory(""): Don't append path separator if path is empty
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled

(cherry picked from commit 1db6d5381a)
This commit is contained in:
Petar Popovic
2026-04-23 22:53:16 -04:00
committed by Ryan C. Gordon
parent da032b77ab
commit 8f99954e01
+1 -1
View File
@@ -74,7 +74,7 @@ bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback
#endif
char *pathwithsep = NULL;
int pathwithseplen = SDL_asprintf(&pathwithsep, "%s/", apath ? apath : path);
int pathwithseplen = SDL_asprintf(&pathwithsep, "%s%s", apath ? apath : path, (apath ? *apath : *path) ? "/" : "");
const size_t extralen = apath ? (SDL_strlen(apath) - SDL_strlen(path)) : 0;
SDL_free(apath);
if ((pathwithseplen == -1) || (!pathwithsep)) {