Function

Gimpdirectory

Declaration [src]

const gchar*
gimp_directory (
  void
)

Description [src]

Returns the user-specific GIMP settings directory. If the environment variable GIMP3_DIRECTORY exists, it is used. If it is an absolute path, it is used as is. If it is a relative path, it is taken to be a subdirectory of the home directory. If it is a relative path, and no home directory can be determined, it is taken to be a subdirectory of gimp_data_directory().

The usual case is that no GIMP3_DIRECTORY environment variable exists, and then we use the GIMPDIR subdirectory of the local configuration directory:

  • UNIX: $XDG_CONFIG_HOME (defaults to $HOME/.config/)

  • Windows: CSIDL_APPDATA

  • OSX (UNIX exception): the Application Support Directory.

If neither the configuration nor home directory exist, g_get_user_config_dir() will return {tmp}/{user_name}/.config/ where the temporary directory {tmp} and the {user_name} are determined according to platform rules.

In any case, we always return some non-empty string, whether it corresponds to an existing directory or not.

In config files such as gimprc, the string ${gimp_dir} expands to this directory.

The returned string is owned by GIMP and must not be modified or freed. The returned string is in the encoding used for filenames by GLib, which isn’t necessarily UTF-8 (on Windows it is always UTF-8.)

Return value

Type: const gchar*

The user-specific GIMP settings directory.

The data is owned by the called function.
The value is a NUL terminated UTF-8 string.