Function sdl2_sys::SDL_GetBasePath

source ·
pub unsafe extern "C" fn SDL_GetBasePath() -> *mut c_char
Expand description

\brief Get the path where the application resides.

Get the “base path”. This is the directory where the application was run from, which is probably the installation directory, and may or may not be the process’s current working directory.

This returns an absolute path in UTF-8 encoding, and is guaranteed to end with a path separator (‘\’ on Windows, ‘/’ most other places).

The pointer returned by this function is owned by you. Please call SDL_free() on the pointer when you are done with it, or it will be a memory leak. This is not necessarily a fast call, though, so you should call this once near startup and save the string if you need it.

Some platforms can’t determine the application’s path, and on other platforms, this might be meaningless. In such cases, this function will return NULL.

\return String of base dir in UTF-8 encoding, or NULL on error.

\sa SDL_GetPrefPath