SDL_ENUMERATESTORAGEDIRECTORY(3)
β¨ SDL_EnumerateStorageDirectory(3) β¨
okay bestie, welcome to the SDL3 FUNCTIONS section of the manual π this one lives in SDL_EnumerateStorageDirectory(3) and it's genuinely so useful, come sit with me.
π NAME π
SDL_EnumerateStorageDirectory β Enumerate a directory in a storage container through a callback function.
like, you wanna peek inside a folder that lives in a storage container, and you want each lil entry handed to you one at a time through a callback? yeah. that's the whole vibe. π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_storage.h>
bool SDL_EnumerateStorageDirectory(SDL_Storage *storage, const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata);
no cap, that's the whole signature. copy it exactly, she's precise π
π¦ DESCRIPTION π¦
This function provides every directory entry through an app-provided callback, called once for each directory entry, until all results have been provided or the callback returns either SDL_ENUM_SUCCESS or SDL_ENUM_FAILURE.
so likeβ¦ the callback keeps getting pinged, entry by entry, and it stops early if the callback says SDL_ENUM_SUCCESS or SDL_ENUM_FAILURE. it's giving very "we go until we're done or you tell me to stop" energy β¨
This will return false if there was a system problem in general, or if a callback returns SDL_ENUM_FAILURE. A successful return means a callback returned SDL_ENUM_SUCCESS to halt enumeration, or all directory entries were enumerated.
translation bestie: false = something broke system-wise, or your callback hit SDL_ENUM_FAILURE. true = either your callback returned SDL_ENUM_SUCCESS and stopped the whole thing early, or every single entry got enumerated. both are wins π«Ά
If path is NULL, this is treated as a request to enumerate the root of the storage container's tree. An empty string also works for this.
yes literally, NULL or an empty string both mean "gimme the root of the tree". iconic, honestly π³
π FUNCTION PARAMETERS π
storageβ a storage container. the whole point, the main character πpathβ the path of the directory to enumerate, orNULLfor the root. (NULLand""are both root, remember!)callbackβ a function that is called for each entry in the directory. your lil per-entry notifier π£userdataβ a pointer that is passed tocallback. your lil care package that rides along for the journey π
β RETURN VALUE β
Returns true on success or false on failure; call SDL_GetError() for more information.
so if it's false, go ask SDL_GetError() what's wrong, she always knows π
π AVAILABILITY π
This function is available since SDL 3.2.0.
(if you're on something older than 3.2.0, this one's not for you yet, no cap π)
π SEE ALSO π
and that's the page bestie, you ate it π
Simple Directmedia Layer β SDL 3.4.18 β mwah, sending you the SDL_EnumerateStorageDirectory(3) energy, go slay your directory enumeration π¦β¨π
π¦ 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