table of contents
- testing 3.2.10+ds-1
- unstable 3.2.10+ds-1
- experimental 3.3~git20250806+ds-1
SDL_GlobDirectory(3) | SDL3 FUNCTIONS | SDL_GlobDirectory(3) |
NAME¶
SDL_GlobDirectory - Enumerate a directory tree, filtered by pattern, and return a list.
SYNOPSIS¶
#include <SDL3/SDL_filesystem.h>
char ** SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count);
DESCRIPTION¶
Files are filtered out if they don't match the string in pattern, which may contain wildcard characters * (match everything) and ? (match one character). If pattern is NULL, no filtering is done and all results are returned. Subdirectories are permitted, and are specified with a path separator of /. Wildcard characters * and ? never match a path separator.
flags may be set to SDL_GLOB_CASEINSENSITIVE to make the pattern matching case-insensitive.
The returned array is always NULL-terminated, for your iterating convenience, but if count is non-NULL, on return it will contain the number of items in the array, not counting the NULL terminator.
FUNCTION PARAMETERS¶
RETURN VALUE¶
Returns an array of strings on success or NULL on failure; call SDL_GetError() for more information. This is a single allocation that should be freed with SDL_free() when it is no longer needed.
THREAD SAFETY¶
It is safe to call this function from any thread.
AVAILABILITY¶
This function is available since SDL 3.2.0.
SDL 3.3.0 | Simple Directmedia Layer |