FileEnumerator

open class FileEnumerator(pointer: <Error class: unknown class><<Error class: unknown class>>)

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.

Skipped during bindings generation

  • parameter out_info: out_info: Out parameter is not supported

  • method container: Property has no getter nor setter

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val gioFileEnumeratorPointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard
open fun close(cancellable: Cancellable? = null): <Error class: unknown class><Boolean>

Releases all resources used by this enumerator, making the enumerator return %G_IO_ERROR_CLOSED on all calls.

Link copied to clipboard
open fun closeAsync(ioPriority: <Error class: unknown class>, cancellable: Cancellable? = null, callback: AsyncReadyCallback?)

Asynchronously closes the file enumerator.

Link copied to clipboard
open fun closeFinish(result: AsyncResult): <Error class: unknown class><Boolean>

Finishes closing a file enumerator, started from g_file_enumerator_close_async().

Link copied to clipboard
open fun getChild(info: FileInfo): File

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

Link copied to clipboard
open fun getContainer(): File

Get the #GFile container which is being enumerated.

Link copied to clipboard
open fun hasPending(): Boolean

Checks if the file enumerator has pending operations.

Link copied to clipboard
open fun isClosed(): Boolean

Checks if the file enumerator has been closed.

Link copied to clipboard
open fun nextFile(cancellable: Cancellable? = null): <Error class: unknown class><FileInfo?>

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.

Link copied to clipboard
open fun nextFilesAsync(numFiles: <Error class: unknown class>, ioPriority: <Error class: unknown class>, cancellable: Cancellable? = null, callback: AsyncReadyCallback?)

Request information for a number of files from the enumerator asynchronously. When all I/O for the operation is finished the @callback will be called with the requested information.

Link copied to clipboard
open fun nextFilesFinish(result: AsyncResult): <Error class: unknown class><<Error class: unknown class>>

Finishes the asynchronous operation started with g_file_enumerator_next_files_async().

Link copied to clipboard
open fun setPending(pending: Boolean)

Sets the file enumerator as having pending operations.