Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: GDir

[12:7] extends: object

An opaque structure representing an opened directory.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • GDir (path = null, flags = null)

    Opens a directory for reading. The names of the files in the directory can then be retrieved using g_dir_read_name(). Note that the ordering is not defined.

    • @p path is the path to the directory you are interested in. On Unix in the on-disk encoding. On Windows in UTF-8.
    • @p flags is Currently must be set to 0. Reserved for future use..
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • close ()

    Closes the directory immediately and decrements the reference count. Once the reference count reaches zero, the GDir structure itself will be freed. Prior to GLib 2.80, GDir was not reference counted. It is an error to call any of the GDir methods other than [method@GLib.Dir.ref] and [method@GLib.Dir.unref] on a GDir after calling [method@GLib.Dir.close] on it.

    • @r None.
  • read_name ()

    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.

    • @r 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..
  • ref ()

    Increment the reference count of dir.

    • @r the same pointer as dir.
  • rewind ()

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

    • @r None.
  • unref ()

    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 [method@GLib.Dir.close] is called when the reference count is greater than zero, the directory is closed but the GDir structure will not be freed until its reference count reaches zero. It is an error to call any of the GDir methods other than [method@GLib.Dir.ref] and [method@GLib.Dir.unref] on a GDir after calling [method@GLib.Dir.close] on it.

    • @r None.