SDL_ShowOpenFolderDialog(3)
π SDL_ShowOpenFolderDialog π
okay bestie, welcome to the SDL_ShowOpenFolderDialog(3) page, straight out of the SDL3 FUNCTIONS lineup π«Ά
β¨ NAME β¨
SDL_ShowOpenFolderDialog β pops up a lil dialog that lets the user pick a folder off their filesystem π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_dialog.h>
void SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const char *default_location, bool allow_many);
β¨ DESCRIPTION β¨
so this one is asynchronous, meaning it dips out immediately and hands the result over to your callback later. no waiting around, she's busy π
The callback gets invoked with a null-terminated list of the files the user chose. If the user canceled the dialog, that list is empty. If something went wrong, the list is NULL π
heads up: the callback may get called from a different thread than the one you invoked the function on. stay woke π§
Depending on the platform, the user might be allowed to type in paths that don't even exist yet. yes fr fr.
On Linux, dialogs may require XDG Portals, which requires DBus, which requires an event-handling loop. So if your app does not use SDL to handle events, add a call to SDL_PumpEvents in your main loop. periodt π
β¨ FUNCTION PARAMETERS β¨
callbackβ a function pointer that gets invoked when the user selects a file and accepts, or cancels the dialog, or an error happens πΈuserdataβ an optional pointer you can pass extra data through to the callback when it gets invoked πwindowβ the window the dialog should be modal for, may beNULL. Not all platforms support this option πdefault_locationβ the default folder or file to start the dialog at, may beNULL. Not all platforms support this option π¦allow_manyβ if non-zero, the user will be allowed to select multiple entries. Not all platforms support this option β¨
β¨ THREAD SAFETY β¨
Call this function from the main thread only, bestie. The callback itself may be invoked from the same thread or from a different one, depending on whatever constraints the OS is serving that day π
β¨ AVAILABILITY β¨
This function is available since SDL 3.2.0 π
β¨ SEE ALSO β¨
SDL_DialogFileCallback(3type)SDL_ShowOpenFileDialog(3)SDL_ShowSaveFileDialog(3)SDL_ShowFileDialogWithProperties(3)
and that's the whole page, you ate it π β¨
This was brought to you by Simple Directmedia Layer, version SDL 3.4.18 β go pick a folder, main character ππΈ
π¦ 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