Function

GLibget_user_state_dir

since: 2.72

Declaration

const gchar*
g_get_user_state_dir (
  void
)

Description

Returns a base directory in which to store state files specific to particular user.

On UNIX platforms this is determined using the mechanisms described in the XDG Base Directory Specification. In this case the directory retrieved will be XDG_STATE_HOME.

On Windows it follows XDG Base Directory Specification if XDG_STATE_HOME is defined. If XDG_STATE_HOME is undefined, the folder to use for local (as opposed to roaming) application data is used instead. See the documentation for FOLDERID_LocalAppData. Note that in this case on Windows it will be the same as what g_get_user_data_dir() returns.

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.72

Return value

Type: const gchar*

A string owned by GLib that must not be modified or freed.

The data is owned by the called function.
The value is a file system path, using the OS encoding.