SDL Wiki
(This is the documentation for SDL3, which is under heavy development and the API is changing! SDL2 is the current stable version!)


Finds the most suitable OS-provided folder for @p folder, and returns its path in OS-specific notation.


char* SDL_GetPath(SDL_Folder folder);

Function Parameters

folder The type of folder to find

Return Value

Returns Either a null-terminated C string containing the full path to the folder, or NULL if an error happened.


Many OSes provide certain standard folders for certain purposes, such as storing pictures, music or videos for a certain user. This function gives the path for many of those special locations.

Note that the function is expensive, and should be called once at the beginning of the execution and kept for as long as needed.

The returned value is owned by the caller and should be freed with SDL_free().

If NULL is returned, the error may be obtained with SDL_GetError().


This function is available since SDL 3.0.0.


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.