mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-28 16:58:44 +00:00
SDL_InternalGlobDirectory(): set string length of base directory to 1, if it's just one slash
This commit is contained in:
parent
93e3e8a5fe
commit
67ac0e5eee
1 changed files with 8 additions and 1 deletions
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue