Class (GI Struct)

GLib-2.0GLibDir

An opaque structure representing an opened directory.

Index

Constructors

Properties

Methods

Constructors

Properties

$gtype: GType<GLib.Dir>

Methods

  • Retrieves the name of another entry in the directory, or null. The order of entries returned from this function is not defined, and may vary by file system or other operating-system dependent factors.

    null may also be returned in case of errors. On Unix, you can check errno to find out if null was returned because of an error.

    On Unix, the '.' and '..' entries are omitted, and the returned name is in the on-disk encoding.

    On Windows, as is true of all GLib functions which operate on filenames, the returned name is in UTF-8.

    Returns string

    The entry's name or null if there are no more entries. The return value is owned by GLib and must not be modified or freed.

  • Resets the given directory. The next call to g_dir_read_name() will return the first entry again.

    Returns void

  • Decrements the reference count of dir.

    Once the reference count reaches zero, the directory will be closed and all resources associated with it will be freed. If GLib.Dir.close is called when the reference count is greater than zero, the directory is closed but the GLib.Dir structure will not be freed until its reference count reaches zero.

    It is an error to call any of the GLib.Dir methods other than GLib.Dir.ref and GLib.Dir.unref on a GLib.Dir after calling GLib.Dir.close on it.

    Returns void

  • Creates a subdirectory in the preferred directory for temporary files (as returned by g_get_tmp_dir()).

    tmpl should be a string in the GLib file name encoding containing a sequence of six 'X' characters, as the parameter to g_mkstemp(). However, unlike these functions, the template should only be a basename, no directory components are allowed. If template is null, a default template is used.

    Note that in contrast to g_mkdtemp() (and mkdtemp()) tmpl is not modified, and might thus be a read-only literal string.

    Parameters

    • Optionaltmpl: string

      Template for directory name, as in g_mkdtemp(), basename only, or null for a default template

    Returns string