FileInfo
Stores information about a file system object referenced by a iface@Gio.File.
Functionality for manipulating basic metadata for files. GFileInfo
implements methods for getting information that all files should contain, and allows for manipulation of extended attributes.
See file attributes for more information on how GIO handles file attributes.
To obtain a GFileInfo
for a iface@Gio.File, use method@Gio.File.query_info (or its async variant). To obtain a GFileInfo
for a file input or output stream, use method@Gio.FileInputStream.query_info or method@Gio.FileOutputStream.query_info (or their async variants).
To change the actual attributes of a file, you should then set the attribute in the GFileInfo
and call method@Gio.File.set_attributes_from_info or method@Gio.File.set_attributes_async on a GFile
.
However, not all attributes can be changed in the file. For instance, the actual size of a file cannot be changed via method@Gio.FileInfo.set_size. You may call method@Gio.File.query_settable_attributes and method@Gio.File.query_writable_namespaces to discover the settable attributes of a particular file at runtime.
The direct accessors, such as method@Gio.FileInfo.get_name, are slightly more optimized than the generic attribute accessors, such as method@Gio.FileInfo.get_attribute_byte_string.This optimization will matter only if calling the API in a tight loop.
It is an error to call these accessors without specifying their required file attributes when creating the GFileInfo
. Use method@Gio.FileInfo.has_attribute or method@Gio.FileInfo.list_attributes to check what attributes are specified for a GFileInfo
.
struct@Gio.FileAttributeMatcher allows for searching through a GFileInfo
for attributes.
Skipped during bindings generation
parameter
type
: type: Out parameter is not supported
Constructors
Functions
Clears the status information from @info.
Gets the access time of the current @info and returns it as a #GDateTime.
Gets the value of an attribute, formatted as a string. This escapes things as needed to make the string valid UTF-8.
Gets the value of a boolean attribute. If the attribute does not contain a boolean value, false will be returned.
Gets the value of a byte string attribute. If the attribute does not contain a byte string, null will be returned.
Gets the value of a byte string attribute as a file path.
Gets a signed 32-bit integer contained within the attribute. If the attribute does not contain a signed 32-bit integer, or is invalid, 0 will be returned.
Gets a signed 64-bit integer contained within the attribute. If the attribute does not contain a signed 64-bit integer, or is invalid, 0 will be returned.
Gets the value of a #GObject attribute. If the attribute does not contain a #GObject, null will be returned.
Gets the attribute status for an attribute key.
Gets the value of a string attribute. If the attribute does not contain a string, null will be returned.
Gets the value of a stringv attribute. If the attribute does not contain a stringv, null will be returned.
Gets the attribute type for an attribute key.
Gets an unsigned 32-bit integer contained within the attribute. If the attribute does not contain an unsigned 32-bit integer, or is invalid, 0 will be returned.
Gets a unsigned 64-bit integer contained within the attribute. If the attribute does not contain an unsigned 64-bit integer, or is invalid, 0 will be returned.
Gets the file's content type.
Gets the creation time of the current @info and returns it as a #GDateTime.
Returns the #GDateTime representing the deletion date of the file, as available in %G_FILE_ATTRIBUTE_TRASH_DELETION_DATE. If the %G_FILE_ATTRIBUTE_TRASH_DELETION_DATE attribute is unset, null is returned.
Gets a display name for a file. This is guaranteed to always be set.
Gets the edit name for a file.
Gets a file's type (whether it is a regular file, symlink, etc). This is different from the file's content type, see g_file_info_get_content_type().
Checks if a file is a backup file.
Checks if a file is hidden.
Checks if a file is a symlink.
Gets the modification time of the current @info and returns it as a #GDateTime.
This is deprecated since version 2.62.
Gets the value of the sort_order attribute from the #GFileInfo. See %G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.
Gets the symbolic icon for a file.
Gets the symlink target for a given #GFileInfo.
Checks if a file info structure has an attribute named @attribute.
Checks if a file info structure has an attribute in the specified @name_space.
Lists the file info structure's attributes.
Removes all cases of @attribute from @info if it exists.
Sets the %G_FILE_ATTRIBUTE_TIME_ACCESS and %G_FILE_ATTRIBUTE_TIME_ACCESS_USEC attributes in the file info to the given date/time value.
Sets the @attribute to contain the given value, if possible. To unset the attribute, use %G_FILE_ATTRIBUTE_TYPE_INVALID for @type.
Sets the @attribute to contain the given @attr_value, if possible.
Sets the @attribute to contain the given @attr_value, if possible.
Sets the @attribute to contain the given @attr_value, if possible.
Sets the @attribute to contain the given @attr_value, if possible.
Sets the @attribute to contain the given @attr_value, if possible.
Sets @mask on @info to match specific attribute types.
Sets the @attribute to contain the given @attr_value, if possible.
Sets the attribute status for an attribute key. This is only needed by external code that implement g_file_set_attributes_from_info() or similar functions.
Sets the @attribute to contain the given @attr_value, if possible.
Sets the @attribute to contain the given @attr_value, if possible.
Sets the @attribute to contain the given @attr_value, if possible.
Sets the @attribute to contain the given @attr_value, if possible.
Sets the content type attribute for a given #GFileInfo. See %G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE.
Sets the %G_FILE_ATTRIBUTE_TIME_CREATED and %G_FILE_ATTRIBUTE_TIME_CREATED_USEC attributes in the file info to the given date/time value.
Sets the display name for the current #GFileInfo. See %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.
Sets the edit name for the current file. See %G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME.
Sets the file type in a #GFileInfo to @type. See %G_FILE_ATTRIBUTE_STANDARD_TYPE.
Sets the "is_hidden" attribute in a #GFileInfo according to @is_hidden. See %G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.
Sets the "is_symlink" attribute in a #GFileInfo according to @is_symlink. See %G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.
Sets the %G_FILE_ATTRIBUTE_TIME_MODIFIED and %G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC attributes in the file info to the given date/time value.
This is deprecated since version 2.62.
Sets the sort order attribute in the file info structure. See %G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.
Sets the symbolic icon for a given #GFileInfo. See %G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON.
Sets the %G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET attribute in the file info to the given symlink target.
Unsets a mask set by g_file_info_set_attribute_mask(), if one is set.