Function

GLibget_system_data_dirs

since: 2.6

Declaration

const gchar* const*
g_get_system_data_dirs (
  void
)

Description

Returns an ordered list of base directories in which to access system-wide application data.

On UNIX platforms this is determined using the mechanisms described in the XDG Base Directory Specification In this case the list of directories retrieved will be XDG_DATA_DIRS.

On Windows it follows XDG Base Directory Specification if XDG_DATA_DIRS is defined. If XDG_DATA_DIRS is undefined, the first elements in the list are the Application Data and Documents folders for All Users. (These can be determined only on Windows 2000 or later and are not present in the list on other Windows versions.) See documentation for FOLDERID_ProgramData and FOLDERID_PublicDocuments.

Then follows the “share” subfolder in the installation folder for the package containing the DLL that calls this function, if it can be determined.

Finally the list contains the “share” subfolder in the installation folder for GLib, and in the installation folder for the package the application’s .exe file belongs to.

The installation folders above are determined by looking up the folder where the module (DLL or EXE) in question is located. If the folder’s name is “bin”, its parent is used, otherwise the folder itself.

Note that on Windows the returned list can vary depending on where this function is called.

The return value is cached and modifying it at runtime is not supported, as it’s not thread-safe to modify environment variables at runtime.

Available since: 2.6

Return value

Type: An array of filename

a `NULL`-terminated array of strings owned by GLib that must not be
modified or freed.
The array is NULL-terminated.
The data is owned by the called function.
Each element is a file system path, using the OS encoding.