Gimp.ConfigPath

g Gimp.ConfigPath Gimp.ConfigPath

Subclasses:

None

Methods

class

expand (path, recode)

class

expand_to_files (path)

class

unexpand (path, recode)

Virtual Methods

None

Fields

None

Class Details

class Gimp.ConfigPath
Abstract:

No

classmethod expand(path, recode)
Parameters:
  • path (str) – a NUL-terminated string in UTF-8 encoding

  • recode (bool) – whether to convert to the filesystem’s encoding

Raises:

GLib.Error

Returns:

a newly allocated NUL-terminated string

Return type:

str

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.ConfigPath.unexpand().

New in version 2.4.

classmethod expand_to_files(path)
Parameters:

path (str) – a NUL-terminated string in UTF-8 encoding

Raises:

GLib.Error

Returns:

a GLib.List of newly allocated Gio.File objects.

Return type:

[Gio.File]

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.ConfigPath.expand() and Gimp.Path.parse(), then turns the filenames returned by Gimp.Path.parse() into Gio.File using Gio.File.new_for_path().

New in version 2.10.

classmethod unexpand(path, recode)
Parameters:
  • path (str) – a NUL-terminated string

  • recode (bool) – whether path is in filesystem encoding or UTF-8

Raises:

GLib.Error

Returns:

a newly allocated NUL-terminated UTF-8 string

Return type:

str

The inverse operation of Gimp.ConfigPath.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.

New in version 2.10.