mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-31 14:29:14 +08:00
SDL_EnumerateDirectory(""): Don't append path separator if path is empty
This commit is contained in:
committed by
Ryan C. Gordon
parent
f2206974b0
commit
1db6d5381a
@@ -74,7 +74,7 @@ bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *pathwithsep = NULL;
|
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;
|
const size_t extralen = apath ? (SDL_strlen(apath) - SDL_strlen(path)) : 0;
|
||||||
SDL_free(apath);
|
SDL_free(apath);
|
||||||
if ((pathwithseplen == -1) || (!pathwithsep)) {
|
if ((pathwithseplen == -1) || (!pathwithsep)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user