GimpConfig-path

## GimpConfig-path GimpConfig-path — File path utilities for libgimpconfig. |

## Functions

GParamSpec * | gimp_param_spec_config_path ()
GimpConfigPathType | gimp_param_spec_config_path_type ()
gchar * | gimp_config_path_expand ()
GList * | gimp_config_path_expand_to_files ()
gchar * | gimp_config_path_unexpand ()
GFile * | gimp_file_new_for_config_path ()
gchar * | gimp_file_get_config_path ()
gchar * | gimp_config_build_data_path ()
gchar * | gimp_config_build_writable_path ()
gchar * | gimp_config_build_plug_in_path ()
#define | GIMP_VALUE_HOLDS_CONFIG_PATH()

## Types and Values

typedef | GimpConfigPath
enum | GimpConfigPathType

## Description

File path utilities for libgimpconfig.

## Functions

### gimp_param_spec_config_path ()

    GParamSpec *
    gimp_param_spec_config_path (const gchar *name,
                                 const gchar *nick,
                                 const gchar *blurb,
                                 GimpConfigPathType type,
                                 const gchar *default_value,
                                 GParamFlags flags);

Creates a param spec to hold a filename, dir name, or list of file or dir names. See `g_param_spec_internal()` for more information.

#### Parameters

name | Canonical name of the param |
nick | Nickname of the param |
blurb | Brief description of param. |
type | a GimpConfigPathType value. |
default_value | Value to use if none is assigned. |
flags | a combination of GParamFlags |

#### Returns

a newly allocated GParamSpec instance

Since: 2.4

### gimp_param_spec_config_path_type ()

    GimpConfigPathType
    gimp_param_spec_config_path_type (GParamSpec *pspec);

Tells whether the path param encodes a filename, dir name, or list of file or dir names.

#### Parameters

pspec | A GParamSpec for a path param |

#### Returns

a GimpConfigPathType value

Since: 2.4

### gimp_config_path_expand ()

    gchar *
    gimp_config_path_expand (const gchar *path,
                             gboolean recode,
                             GError **error);

Paths as stored in gimprc and other config files have to be treated special. The string may contain special identifiers such as for example ${gimp_dir} that have to be substituted before use. Also the user's filesystem may be in a different encoding than UTF-8 (which is what is used for the gimprc). This function does the variable substitution for you and can also attempt to convert to the filesystem encoding.

To reverse the expansion, use `gimp_config_path_unexpand()`.

#### Parameters

path | a NUL-terminated string in UTF-8 encoding |
recode | whether to convert to the filesystem's encoding |
error | return location for errors |

#### Returns

a newly allocated NUL-terminated string

Since: 2.4

### gimp_config_path_expand_to_files ()

    GList *
    gimp_config_path_expand_to_files (const gchar *path,
                                      GError **error);

Paths as stored in the gimprc have to be treated special. The string may contain special identifiers such as for example ${gimp_dir} that have to be substituted before use. Also the user's filesystem may be in a different encoding than UTF-8 (which is what is used for the gimprc).

This function runs `path` through `gimp_config_path_expand()` and `gimp_path_parse()`, then turns the filenames returned by `gimp_path_parse()` into GFile using `g_file_new_for_path()`.

#### Parameters

path | a NUL-terminated string in UTF-8 encoding |
error | return location for errors |

#### Returns

a GList of newly allocated GFile objects.

Since: 2.10

### gimp_config_path_unexpand ()

    gchar *
    gimp_config_path_unexpand (const gchar *path,
                               gboolean recode,
                               GError **error);

The inverse operation of `gimp_config_path_expand()`

This function takes a `path` and tries to substitute the first elements by well-known special identifiers such as for example ${gimp_dir}. The unexpanded path can then be stored in gimprc and other config files.

If `recode` is `TRUE` then `path` is in local filesystem encoding, if `recode` is `FALSE` then `path` is assumed to be UTF-8.

#### Parameters

path | a NUL-terminated string |
recode | whether `path` is in filesystem encoding or UTF-8 |
error | return location for errors |

#### Returns

a newly allocated NUL-terminated UTF-8 string

Since: 2.10

### gimp_file_new_for_config_path ()

    GFile *
    gimp_file_new_for_config_path (const gchar *path,
                                   GError **error);

Expands `path` using `gimp_config_path_expand()` and returns a GFile for the expanded path.

To reverse the expansion, use `gimp_file_get_config_path()`.

#### Parameters

path | a NUL-terminated string in UTF-8 encoding |
error | return location for errors |

#### Returns

a newly allocated GFile, or `NULL` if the expansion failed.

Since: 2.10

### gimp_file_get_config_path ()

    gchar *
    gimp_file_get_config_path (GFile *file,
                               GError **error);

Unexpands `file` 's path using `gimp_config_path_unexpand()` and returns the unexpanded path.

The inverse operation of `gimp_file_new_for_config_path()`.

#### Parameters

file | a GFile |
error | return location for errors |

#### Returns

a newly allocated NUL-terminated UTF-8 string, or `NULL` if unexpanding failed.

Since: 2.10

### gimp_config_build_data_path ()

    gchar *
    gimp_config_build_data_path (const gchar *name);

Creates a search path as it is used in the gimprc file. The path returned by `gimp_config_build_data_path()` includes a directory below the user's gimp directory and one in the system-wide data directory.

Note that you cannot use this path directly with `gimp_path_parse()`. As it is in the gimprc notation, you first need to expand and recode it using `gimp_config_path_expand()`.

#### Parameters

name | directory name (in UTF-8 encoding) |

#### Returns

a newly allocated string

Since: 2.4

### gimp_config_build_writable_path ()

    gchar *
    gimp_config_build_writable_path (const gchar *name);

Creates a search path as it is used in the gimprc file. The path returned by `gimp_config_build_writable_path()` is just the writable parts of the search path constructed by `gimp_config_build_data_path()`.

Note that you cannot use this path directly with `gimp_path_parse()`. As it is in the gimprc notation, you first need to expand and recode it using `gimp_config_path_expand()`.

#### Parameters

name | directory name (in UTF-8 encoding) |

#### Returns

a newly allocated string

Since: 2.4

### gimp_config_build_plug_in_path ()

    gchar *
    gimp_config_build_plug_in_path (const gchar *name);

Creates a search path as it is used in the gimprc file. The path returned by `gimp_config_build_plug_in_path()` includes a directory below the user's gimp directory and one in the system-wide plug-in directory.

Note that you cannot use this path directly with `gimp_path_parse()`. As it is in the gimprc notation, you first need to expand and recode it using `gimp_config_path_expand()`.

#### Parameters

name | directory name (in UTF-8 encoding) |

#### Returns

a newly allocated string

Since: 2.4

### GIMP_VALUE_HOLDS_CONFIG_PATH()

    #define GIMP_VALUE_HOLDS_CONFIG_PATH(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_CONFIG_PATH))

## Types and Values

### GimpConfigPath

### enum GimpConfigPathType

#### Members

GIMP_CONFIG_PATH_FILE |  |
GIMP_CONFIG_PATH_FILE_LIST |  |
GIMP_CONFIG_PATH_DIR |  |
GIMP_CONFIG_PATH_DIR_LIST |  |