SDL_GetUserFolder(3)
π SDL_GetUserFolder(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where today's main character is SDL_GetUserFolder π«Ά
β¨ NAME β¨
SDL_GetUserFolder β finds the most suitable user folder for a specific purpose. no cap, that's literally the whole job π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_filesystem.h>
const char * SDL_GetUserFolder(SDL_Folder folder);
π¦ DESCRIPTION π¦
so like, most OSes out here are giving us certain standard folders for certain purposes β think storing pictures, music or videos for a certain user. this function hands you the path for a whole bunch of those special locations. iconic behaviour honestly π
but listen, this one is specifically for user folders β the kind that are meant for the user to actually access and manage themselves. if you're looking for application-specific folders, the ones meant to hold data for the application to manage, then go check out SDL_GetBasePath() and SDL_GetPrefPath() instead. different vibe, different purpose, iykyk β¨
the returned path is guaranteed to end with a path separator ('\\' on Windows, '/' on most other platforms). yes queen, it always closes with the separator π
and if NULL comes back? that's your cue that something went wrong, and you can grab the error with SDL_GetError(). π
π FUNCTION PARAMETERS π
folderβ the type of folder to find. that's the one and only thing you're passing in, bestie.
π RETURN VALUE π
it returns either a null-terminated C string containing the full path to the folder, or NULL if an error happened. so like... either you get the path or you get nothing and you go check SDL_GetError(). that's the whole deal π«Ά
β THREAD SAFETY β
it is safe to call this function from any thread. go off, multithreaded queen π
π AVAILABILITY π
this function is available since SDL 3.2.0. so if you're on anything older, sorry babe, no folder for you π
π tiny reminder: if you getNULLback, do not just start using it. callSDL_GetError()and read the tea before you do anything else.
and that's the page, bestie!! brought to you by the fine folks at Simple Directmedia Layer, running the SDL 3.4.18 era of life π this whole thing is SDL_GetUserFolder(3) and it ate, no crumbs, periodt β¨π
π¦ 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