SDL_ENUMERATEDIRECTORYCALLBACK(3type)
π SDL_EnumerateDirectoryCallback β the SDL3 DATATYPES glow-up π
okay so bestie, welcome to the <SDL_Enumera...oryCallback>(3type) page, straight out of the SDL3 DATATYPES section. this one's short, sweet, and lowkey iconic: it's the callback you hand over when you want SDL to walk a directory for you and ping you for every single thing it finds. let's get into it π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_filesystem.h>
typedef SDL_EnumerationResult (SDLCALL *SDL_EnumerateDirectoryCallback)(void *userdata, const char *dirname, const char *fname);
that's the whole signature, no notes, she's perfect π
πΈ DESCRIPTION πΈ
so here's the vibe: SDL is gonna keep feeding directory entries to your callback. it does not stop until one of two things happens β either every single entry has been handed over, or your callback says "okay bestie, we're done here" through its return value. that's it, that's the whole relationship π¦
- returning
SDL_ENUM_CONTINUEmeans "keep going, I'm not done yet" β enumeration proceeds and the callback gets called again with more entries. - returning
SDL_ENUM_SUCCESSorSDL_ENUM_FAILUREterminates the enumeration early, and whichever one you picked also dictates the return value of the enumeration function itself. so like, you're literally steering the whole ship here π
and a lil detail that matters: dirname is guaranteed to end with a path separator β that's '\\' on Windows and '/' on most other platforms. no cap, it's always gonna be there, so you can trust it π
π§ FUNCTION PARAMETERS π§
userdataβ an app-controlled pointer that gets passed straight to the callback. it's yours, do whatever you want with it πdirnameβ the directory that is being enumerated.fnameβ the next entry in the enumeration. one at a time, bestie, we're being methodical π
β RETURN VALUE β
Returns how the enumeration should proceed. that's the whole deal β you're the main character deciding whether the walk continues or wraps up β¨
π AVAILABILITY π
This datatype is available since SDL 3.2.0. so if you're on anything older, sorry bestie, you're out of luck π
π₯ SEE ALSO π₯
ngl, this is one of those pages where the whole personality is in the return value. don't sleep on SDL_ENUM_CONTINUE β it's doing a lot of heavy lifting π«Ά
and that's a wrap!! this page came to you from Simple Directmedia Layer, version SDL 3.4.18 β mwah, sending you off with the date it was born, stay slay, go enumerate some directories ππβ¨
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms