Basics
Guides
API Reference
Basics
Guides
API Reference
[30:7] extends: object
GFileEnumerator allows you to operate on a set of [iface@Gio.File] objects,
returning a [class@Gio.FileInfo] structure for each file enumerated (e.g.
[method@Gio.File.enumerate_children] will return a GFileEnumerator for each
of the children within a directory). To get the next file's information from
a GFileEnumerator, use [method@Gio.FileEnumerator.next_file] or its
asynchronous version, [method@Gio.FileEnumerator.next_files_async]. Note that
the asynchronous version will return a list of [class@Gio.FileInfo] objects,
whereas the synchronous will only return the next file in the enumerator. The
ordering of returned files is unspecified for non-Unix platforms; for more
information, see [method@GLib.Dir.read_name]. On Unix, when operating on
local files, returned files will be sorted by inode number. Effectively you
can assume that the ordering of returned files will be stable between
successive calls (and applications) assuming the directory is unchanged. If
your application needs a specific ordering, such as by name or modification
time, you will have to implement that in your application code. To close a
GFileEnumerator, use [method@Gio.FileEnumerator.close], or its asynchronous
version, [method@Gio.FileEnumerator.close_async]. Once a GFileEnumerator is
closed, no further actions may be performed on it, and it should be freed
with [method@GObject.Object.unref].
FileEnumerator (Handle = null)
Creates a new
FileEnumeratorby wrapping a native handle or another wrapper.
Handle is the native handle or another wrapper whose handle to adopt.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 exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asObject ()
Wraps this handle as
Object.
A Object object.close (object cancellable)
Releases all resources used by this enumerator, making the enumerator return %G_IO_ERROR_CLOSED on all calls. This will be automatically called when the last reference is dropped, but you might want to call this function to make sure resources are released as early as possible.
cancellable is optional #GCancellable object, %NULL to ignore..close_finish (object result)
Finishes closing a file enumerator, started from g_file_enumerator_close_async(). If the file enumerator was already closed when g_file_enumerator_close_async() was called, then this function will report %G_IO_ERROR_CLOSED in @error, and return %FALSE. If the file enumerator had pending operation when the close operation was started, then this function will report %G_IO_ERROR_PENDING, and return %FALSE. If @cancellable was not %NULL, then the operation may have been cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be set, and %FALSE will be returned.
result is a #GAsyncResult..get_child (object info)
Return a new #GFile which refers to the file named by @info in the source directory of @enumerator. This function is primarily intended to be used inside loops with g_file_enumerator_next_file(). To use this, %G_FILE_ATTRIBUTE_STANDARD_NAME must have been listed in the attributes list used when creating the #GFileEnumerator. This is a convenience method that's equivalent to: |[ gchar *name = g_file_info_get_name (info); GFile *child = g_file_get_child (g_file_enumerator_get_container (enumr), name); ]|
info is a #GFileInfo gotten from g_file_enumerator_next_file() or the async equivalents..get_container ()
Get the #GFile container which is being enumerated.
has_pending ()
Checks if the file enumerator has pending operations.
is_closed ()
Checks if the file enumerator has been closed.
next_file (object cancellable)
Returns information for the next file in the enumerated object. Will block until the information is available. The #GFileInfo returned from this function will contain attributes that match the attribute string that was passed when the #GFileEnumerator was created. See the documentation of #GFileEnumerator for information about the order of returned files. On error, returns %NULL and sets @error to the error. If the enumerator is at the end, %NULL will be returned and @error will be unset.
cancellable is optional #GCancellable object, %NULL to ignore..next_files_finish (object result)
Finishes the asynchronous operation started with g_file_enumerator_next_files_async().
result is a #GAsyncResult..set_pending (bool pending)
Sets the file enumerator as having pending operations.
pending is a boolean value..None.next_files_finish_list ()
Returns
next_files_finishas an Aussom list of wrapper objects. This companion method materializes the full collection up front; usenext_files_finish()when lazy or change-notify access is required.
An Aussom list of elements.[261:14] static extends: object
Generated metadata helpers for FileEnumerator class surfaces.
properties ()
Returns property metadata for
FileEnumerator.
A list.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.