mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-09 18:45:35 +00:00
SDL_InternalGlobDirectory(): set string length of base directory to 1, if it's just one slash
This commit is contained in:
committed by
Ryan C. Gordon
parent
93e3e8a5fe
commit
67ac0e5eee
@@ -426,8 +426,15 @@ char **SDL_InternalGlobDirectory(const char *path, const char *pattern, SDL_Glob
|
||||
data.enumerator = enumerator;
|
||||
data.getpathinfo = getpathinfo;
|
||||
data.fsuserdata = userdata;
|
||||
data.basedirlen = *path ? (pathlen + 1) : 0; // +1 for the '/' we'll be adding.
|
||||
|
||||
data.basedirlen = 0;
|
||||
if (*path) {
|
||||
if (SDL_strcmp(path, "/") == 0 || SDL_strcmp(path, "\\") == 0) {
|
||||
data.basedirlen = 1;
|
||||
} else {
|
||||
data.basedirlen = pathlen + 1; // +1 for the '/' we'll be adding.
|
||||
}
|
||||
}
|
||||
|
||||
char **result = NULL;
|
||||
if (data.enumerator(path, GlobDirectoryCallback, &data, data.fsuserdata)) {
|
||||
|
||||
Reference in New Issue
Block a user