gio.file_enumerator
Module for [FileEnumerator] class
Types 3
[gio.file_enumerator.FileEnumerator] allows you to operate on a set of [gio.file.File] objects, returning a [gio.file_info.FileInfo] structure for each file enumerated (e.g. [gio.file.File.enumerateChildren] will return a [gio.file_enumerator.FileEnumerator] for each of the children within a directory).
To get the next file's information from a [gio.file_enumerator.FileEnumerator], use [gio.file_enumerator.FileEnumerator.nextFile] or its asynchronous version, [gio.file_enumerator.FileEnumerator.nextFilesAsync]. Note that the asynchronous version will return a list of [gio.file_info.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 [glib.dir.Dir.readName]. 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 [gio.file_enumerator.FileEnumerator], use [gio.file_enumerator.FileEnumerator.close], or its asynchronous version, [gio.file_enumerator.FileEnumerator.closeAsync]. Once a [gio.file_enumerator.FileEnumerator] is closed, no further actions may be performed on it, and it should be freed with [gobject.object.ObjectWrap.unref].
FileEnumerator self()Returns `this`, for use in `with` statements.FileEnumeratorGidBuilder builder()Get builder for [gio.file_enumerator.FileEnumerator] Returns: New builder objectbool close(gio.cancellable.Cancellable cancellable = null)Releases all resources used by this enumerator, making the enumerator return [gio.types.IOErrorEnum.Closed] on all calls.void closeAsync(int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)Asynchronously closes the file enumerator.bool closeFinish(gio.async_result.AsyncResult result)Finishes closing a file enumerator, started from [gio.file_enumerator.FileEnumerator.closeAsync].gio.file.File getChild(gio.file_info.FileInfo 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 [gio.file_enumerator.FileEnumerat...gio.file.File getContainer()Get the #GFile container which is being enumerated. Returns: the #GFile which is being enumerated.bool hasPending()Checks if the file enumerator has pending operations. Returns: true if the enumerator has pending operations.bool isClosed()Checks if the file enumerator has been closed. Returns: true if the enumerator is closed.bool iterate(out gio.file_info.FileInfo outInfo, out gio.file.File outChild, gio.cancellable.Cancellable cancellable = null)This is a version of [gio.fileenumerator.FileEnumerator.nextFile] that's easier to use correctly from C programs. With [gio.fileenumerator.FileEnumerator.nextFile], the gboolean return value signi...gio.file_info.FileInfo nextFile(gio.cancellable.Cancellable cancellable = null)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 attr...void nextFilesAsync(int numFiles, int ioPriority, gio.cancellable.Cancellable cancellable = null, gio.types.AsyncReadyCallback callback = null)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.gio.file_info.FileInfo[] nextFilesFinish(gio.async_result.AsyncResult result)Finishes the asynchronous operation started with [gio.file_enumerator.FileEnumerator.nextFilesAsync].void setPending(bool pending)Sets the file enumerator as having pending operations.T container(gio.file.File propval)Set `container` property. Params: propval = The container that is being enumerated. Returns: Builder instance for fluent chainingFluent builder for [gio.file_enumerator.FileEnumerator]