FileInfo

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

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 the file-attributes.html document 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

  • parameter value_p: gpointer

Constructors

Link copied to clipboard
constructor()

Creates a new file info structure.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

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

Functions

Link copied to clipboard
open fun clearStatus()

Clears the status information from @info.

Link copied to clipboard
open fun copyInto(destInfo: FileInfo)

First clears all of the gio-GFileAttribute of @dest_info, and then copies all of the file attributes from @src_info to @dest_info.

Link copied to clipboard
open fun dup(): FileInfo

Duplicates a file info structure.

Link copied to clipboard
open fun getAccessDateTime(): <Error class: unknown class>?

Gets the access time of the current @info and returns it as a #GDateTime.

Link copied to clipboard
open fun getAttributeAsString(attribute: String): String?

Gets the value of an attribute, formatted as a string. This escapes things as needed to make the string valid UTF-8.

Link copied to clipboard
open fun getAttributeBoolean(attribute: String): Boolean

Gets the value of a boolean attribute. If the attribute does not contain a boolean value, false will be returned.

Link copied to clipboard
open fun getAttributeByteString(attribute: String): String?

Gets the value of a byte string attribute. If the attribute does not contain a byte string, null will be returned.

Link copied to clipboard
open fun getAttributeFilePath(attribute: String): String?

Gets the value of a byte string attribute as a file path.

Link copied to clipboard
open fun getAttributeInt32(attribute: String): Int

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.

Link copied to clipboard
open fun getAttributeInt64(attribute: String): Long

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.

Link copied to clipboard
open fun getAttributeObject(attribute: String): <Error class: unknown class>?

Gets the value of a #GObject attribute. If the attribute does not contain a #GObject, null will be returned.

Link copied to clipboard

Gets the attribute status for an attribute key.

Link copied to clipboard
open fun getAttributeString(attribute: String): String?

Gets the value of a string attribute. If the attribute does not contain a string, null will be returned.

Link copied to clipboard
open fun getAttributeStringv(attribute: String): List<String>?

Gets the value of a stringv attribute. If the attribute does not contain a stringv, null will be returned.

Link copied to clipboard

Gets the attribute type for an attribute key.

Link copied to clipboard
open fun getAttributeUint32(attribute: String): <Error class: unknown class>

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.

Link copied to clipboard
open fun getAttributeUint64(attribute: String): <Error class: unknown class>

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.

Link copied to clipboard
open fun getContentType(): String?

Gets the file's content type.

Link copied to clipboard
open fun getCreationDateTime(): <Error class: unknown class>?

Gets the creation time of the current @info and returns it as a #GDateTime.

Link copied to clipboard
open fun getDeletionDate(): <Error class: unknown class>?

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.

Link copied to clipboard

Gets a display name for a file. This is guaranteed to always be set.

Link copied to clipboard
open fun getEditName(): String

Gets the edit name for a file.

Link copied to clipboard
open fun getEtag(): String?

Gets the iface.File.html#entity-tags for a given #GFileInfo. See %G_FILE_ATTRIBUTE_ETAG_VALUE.

Link copied to clipboard
open fun getFileType(): FileType

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

Link copied to clipboard
open fun getIcon(): Icon?

Gets the icon for a file.

Link copied to clipboard
open fun getIsBackup(): Boolean

Checks if a file is a backup file.

Link copied to clipboard
open fun getIsHidden(): Boolean

Checks if a file is hidden.

Link copied to clipboard
open fun getIsSymlink(): Boolean

Checks if a file is a symlink.

Link copied to clipboard
open fun getModificationDateTime(): <Error class: unknown class>?

Gets the modification time of the current @info and returns it as a #GDateTime.

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

Gets the modification time of the current @info and sets it in @result.

Link copied to clipboard
open fun getName(): String

Gets the name for a file. This is guaranteed to always be set.

Link copied to clipboard
open fun getSize(): Long

Gets the file's size (in bytes). The size is retrieved through the value of the %G_FILE_ATTRIBUTE_STANDARD_SIZE attribute and is converted from #guint64 to #goffset before returning the result.

Link copied to clipboard
open fun getSortOrder(): Int

Gets the value of the sort_order attribute from the #GFileInfo. See %G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.

Link copied to clipboard
open fun getSymbolicIcon(): Icon?

Gets the symbolic icon for a file.

Link copied to clipboard

Gets the symlink target for a given #GFileInfo.

Link copied to clipboard
open fun hasAttribute(attribute: String): Boolean

Checks if a file info structure has an attribute named @attribute.

Link copied to clipboard
open fun hasNamespace(nameSpace: String): Boolean

Checks if a file info structure has an attribute in the specified @name_space.

Link copied to clipboard
open fun listAttributes(nameSpace: String? = null): List<String>?

Lists the file info structure's attributes.

Link copied to clipboard
open fun removeAttribute(attribute: String)

Removes all cases of @attribute from @info if it exists.

Link copied to clipboard
open fun setAccessDateTime(atime: <Error class: unknown class>)

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.

Link copied to clipboard
open fun setAttributeBoolean(attribute: String, attrValue: Boolean)

Sets the @attribute to contain the given @attr_value, if possible.

Link copied to clipboard
open fun setAttributeByteString(attribute: String, attrValue: String)

Sets the @attribute to contain the given @attr_value, if possible.

Link copied to clipboard
open fun setAttributeFilePath(attribute: String, attrValue: String)

Sets the @attribute to contain the given @attr_value, if possible.

Link copied to clipboard
open fun setAttributeInt32(attribute: String, attrValue: Int)

Sets the @attribute to contain the given @attr_value, if possible.

Link copied to clipboard
open fun setAttributeInt64(attribute: String, attrValue: Long)

Sets the @attribute to contain the given @attr_value, if possible.

Link copied to clipboard

Sets @mask on @info to match specific attribute types.

Link copied to clipboard
open fun setAttributeObject(attribute: String, attrValue: <Error class: unknown class>)

Sets the @attribute to contain the given @attr_value, if possible.

Link copied to clipboard
open fun setAttributeStatus(attribute: String, status: FileAttributeStatus): Boolean

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.

Link copied to clipboard
open fun setAttributeString(attribute: String, attrValue: String)

Sets the @attribute to contain the given @attr_value, if possible.

Link copied to clipboard
open fun setAttributeStringv(attribute: String, attrValue: List<String>)

Sets the @attribute to contain the given @attr_value, if possible.

Link copied to clipboard
open fun setAttributeUint32(attribute: String, attrValue: <Error class: unknown class>)

Sets the @attribute to contain the given @attr_value, if possible.

Link copied to clipboard
open fun setAttributeUint64(attribute: String, attrValue: <Error class: unknown class>)

Sets the @attribute to contain the given @attr_value, if possible.

Link copied to clipboard
open fun setContentType(contentType: String)

Sets the content type attribute for a given #GFileInfo. See %G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE.

Link copied to clipboard
open fun setCreationDateTime(creationTime: <Error class: unknown class>)

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.

Link copied to clipboard
open fun setDisplayName(displayName: String)

Sets the display name for the current #GFileInfo. See %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.

Link copied to clipboard
open fun setEditName(editName: String)

Sets the edit name for the current file. See %G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME.

Link copied to clipboard
open fun setFileType(type: FileType)

Sets the file type in a #GFileInfo to @type. See %G_FILE_ATTRIBUTE_STANDARD_TYPE.

Link copied to clipboard
open fun setIcon(icon: Icon)

Sets the icon for a given #GFileInfo. See %G_FILE_ATTRIBUTE_STANDARD_ICON.

Link copied to clipboard
open fun setIsHidden(isHidden: Boolean)

Sets the "is_hidden" attribute in a #GFileInfo according to @is_hidden. See %G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.

Link copied to clipboard
open fun setIsSymlink(isSymlink: Boolean)

Sets the "is_symlink" attribute in a #GFileInfo according to @is_symlink. See %G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.

Link copied to clipboard
open fun setModificationDateTime(mtime: <Error class: unknown class>)

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.

Link copied to clipboard
open fun setModificationTime(mtime: <Error class: unknown class>)

Sets the %G_FILE_ATTRIBUTE_TIME_MODIFIED and %G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC attributes in the file info to the given time value.

Link copied to clipboard
open fun setName(name: String)

Sets the name attribute for the current #GFileInfo. See %G_FILE_ATTRIBUTE_STANDARD_NAME.

Link copied to clipboard
open fun setSize(size: Long)

Sets the %G_FILE_ATTRIBUTE_STANDARD_SIZE attribute in the file info to the given size.

Link copied to clipboard
open fun setSortOrder(sortOrder: Int)

Sets the sort order attribute in the file info structure. See %G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.

Link copied to clipboard
open fun setSymbolicIcon(icon: Icon)

Sets the symbolic icon for a given #GFileInfo. See %G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON.

Link copied to clipboard
open fun setSymlinkTarget(symlinkTarget: String)

Sets the %G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET attribute in the file info to the given symlink target.

Link copied to clipboard

Unsets a mask set by g_file_info_set_attribute_mask(), if one is set.