Package: gio

Function gio:file-query-info

Lambda List

gio:file-query-info (file attributes flags &optional cancellable)

Arguments

file -- a g:file instance
attributes -- an attribute query string
flags -- a g:file-query-info-flags value
cancellable -- an optional g:cancellable instance

Return Value

The g:file-info instance for the given file or nil on error.

Details

Gets the requested information about the specified file. The result is a g:file-info instance that contains key-value attributes, such as the type or size of the file.

The attributes value is a string that specifies the file attributes that should be gathered. It is not an error if it is not possible to read a particular requested attribute from a file, it just will not be set. The attributes argument should be a comma-separated list of attributes or attribute wildcards. The wildcard "" means all attributes, and a wildcard like "standard::" means all attributes in the standard namespace. An example attribute query be "standard::*,owner::user".

If the cancellable argument is not nil, then the operation can be cancelled by triggering the cancellable instance from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned.

For symlinks, normally the information about the target of the symlink is returned, rather than information about the symlink itself. However if you pass :nofollow-symlinks in flags the information about the symlink itself will be returned. Also, for symlinks that point to non-existing files the information about the symlink itself will be returned.

If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
 

See also

2024-12-28