gio.file_info

Module for [FileInfo] class

Types 3

Stores information about a file system object referenced by a gio.file.File.

Functionality for manipulating basic metadata for files. gio.file_info.FileInfo implements methods for getting information that all files should contain, and allows for manipulation of extended attributes.

See file-attributes.html for more information on how GIO handles file attributes.

To obtain a gio.file_info.FileInfo for a gio.file.File, use gio.file.File.queryInfo (or its async variant). To obtain a gio.file_info.FileInfo for a file input or output stream, use gio.file_input_stream.FileInputStream.queryInfo or gio.file_output_stream.FileOutputStream.queryInfo (or their async variants).

To change the actual attributes of a file, you should then set the attribute in the gio.file_info.FileInfo and call gio.file.File.setAttributesFromInfo or gio.file.File.setAttributesAsync on a gio.file.File.

However, not all attributes can be changed in the file. For instance, the actual size of a file cannot be changed via gio.file_info.FileInfo.setSize. You may call gio.file.File.querySettableAttributes and gio.file.File.queryWritableNamespaces to discover the settable attributes of a particular file at runtime.

The direct accessors, such as gio.file_info.FileInfo.getName, are slightly more optimized than the generic attribute accessors, such as gio.file_info.FileInfo.getAttributeByteString.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 gio.file_info.FileInfo. Use gio.file_info.FileInfo.hasAttribute or gio.file_info.FileInfo.listAttributes to check what attributes are specified for a gio.file_info.FileInfo.

gio.file_attribute_matcher.FileAttributeMatcher allows for searching through a gio.file_info.FileInfo for attributes.

Methods
GType _getGType() static nothrow
GType _gType() @property nothrow
FileInfo self() nothrowReturns `this`, for use in `with` statements.
FileInfoGidBuilder builder() static nothrowGet builder for [gio.file_info.FileInfo] Returns: New builder object
void clearStatus() nothrowClears the status information from info.
void copyInto(gio.file_info.FileInfo destInfo) nothrowFirst clears all of the [GFileAttribute][gio-GFileAttribute] of dest_info, and then copies all of the file attributes from src_info to dest_info.
gio.file_info.FileInfo dup() nothrowDuplicates a file info structure. Returns: a duplicate #GFileInfo of other.
glib.date_time.DateTime getAccessDateTime() nothrowGets the access time of the current info and returns it as a #GDateTime.
string getAttributeAsString(string attribute) nothrowGets the value of an attribute, formatted as a string. This escapes things as needed to make the string valid UTF-8.
bool getAttributeBoolean(string attribute) nothrowGets the value of a boolean attribute. If the attribute does not contain a boolean value, false will be returned.
string getAttributeByteString(string attribute) nothrowGets the value of a byte string attribute. If the attribute does not contain a byte string, null will be returned.
bool getAttributeData(string attribute, out gio.types.FileAttributeType type, out void * valuePp, out gio.types.FileAttributeStatus status) nothrowGets the attribute type, value and status for an attribute key.
string getAttributeFilePath(string attribute) nothrowGets the value of a byte string attribute as a file path.
int getAttributeInt32(string attribute) nothrowGets 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.
long getAttributeInt64(string attribute) nothrowGets 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.
gobject.object.ObjectWrap getAttributeObject(string attribute) nothrowGets the value of a #GObject attribute. If the attribute does not contain a #GObject, null will be returned.
gio.types.FileAttributeStatus getAttributeStatus(string attribute) nothrowGets the attribute status for an attribute key.
string getAttributeString(string attribute) nothrowGets the value of a string attribute. If the attribute does not contain a string, null will be returned.
string[] getAttributeStringv(string attribute) nothrowGets the value of a stringv attribute. If the attribute does not contain a stringv, null will be returned.
gio.types.FileAttributeType getAttributeType(string attribute) nothrowGets the attribute type for an attribute key.
uint getAttributeUint32(string attribute) nothrowGets 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.
ulong getAttributeUint64(string attribute) nothrowGets 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.
string getContentType() nothrowGets the file's content type.
glib.date_time.DateTime getCreationDateTime() nothrowGets the creation time of the current info and returns it as a #GDateTime.
glib.date_time.DateTime getDeletionDate() nothrowReturns the #GDateTime representing the deletion date of the file, as available in [gio.types.FILE_ATTRIBUTE_TRASH_DELETION_DATE]. If the [gio.types.FILE_ATTRIBUTE_TRASH_DELETION_DATE] attribute is...
string getDisplayName() nothrowGets a display name for a file. This is guaranteed to always be set.
string getEditName() nothrowGets the edit name for a file.
string getEtag() nothrowGets the [entity tag](iface.File.html#entity-tags) for a given #GFileInfo. See [gio.types.FILE_ATTRIBUTE_ETAG_VALUE].
gio.types.FileType getFileType() nothrowGets a file's type (whether it is a regular file, symlink, etc). This is different from the file's content type, see [gio.file_info.FileInfo.getContentType].
gio.icon.Icon getIcon() nothrowGets the icon for a file.
bool getIsBackup() nothrowChecks if a file is a backup file.
bool getIsHidden() nothrowChecks if a file is hidden.
bool getIsSymlink() nothrowChecks if a file is a symlink.
glib.date_time.DateTime getModificationDateTime() nothrowGets the modification time of the current info and returns it as a #GDateTime.
void getModificationTime(out glib.time_val.TimeVal result) nothrowGets the modification time of the current info and sets it in result.
string getName() nothrowGets the name for a file. This is guaranteed to always be set.
long getSize() nothrowGets the file's size (in bytes). The size is retrieved through the value of the [gio.types.FILE_ATTRIBUTE_STANDARD_SIZE] attribute and is converted from #guint64 to #goffset before returning the re...
int getSortOrder() nothrowGets the value of the sort_order attribute from the #GFileInfo. See [gio.types.FILE_ATTRIBUTE_STANDARD_SORT_ORDER].
gio.icon.Icon getSymbolicIcon() nothrowGets the symbolic icon for a file.
string getSymlinkTarget() nothrowGets the symlink target for a given #GFileInfo.
bool hasAttribute(string attribute) nothrowChecks if a file info structure has an attribute named attribute.
bool hasNamespace(string nameSpace) nothrowChecks if a file info structure has an attribute in the specified name_space.
string[] listAttributes(string nameSpace = null) nothrowLists the file info structure's attributes.
void removeAttribute(string attribute) nothrowRemoves all cases of attribute from info if it exists.
void setAccessDateTime(glib.date_time.DateTime atime) nothrowSets the [gio.types.FILE_ATTRIBUTE_TIME_ACCESS] and [gio.types.FILE_ATTRIBUTE_TIME_ACCESS_USEC] attributes in the file info to the given date/time value.
void setAttribute(string attribute, gio.types.FileAttributeType type, void * valueP) nothrowSets the attribute to contain the given value, if possible. To unset the attribute, use [gio.types.FileAttributeType.Invalid] for type.
void setAttributeBoolean(string attribute, bool attrValue) nothrowSets the attribute to contain the given attr_value, if possible.
void setAttributeByteString(string attribute, string attrValue) nothrowSets the attribute to contain the given attr_value, if possible.
void setAttributeFilePath(string attribute, string attrValue) nothrowSets the attribute to contain the given attr_value, if possible.
void setAttributeInt32(string attribute, int attrValue) nothrowSets the attribute to contain the given attr_value, if possible.
void setAttributeInt64(string attribute, long attrValue) nothrowSets the attribute to contain the given attr_value, if possible.
void setAttributeMask(gio.file_attribute_matcher.FileAttributeMatcher mask) nothrowSets mask on info to match specific attribute types.
void setAttributeObject(string attribute, gobject.object.ObjectWrap attrValue) nothrowSets the attribute to contain the given attr_value, if possible.
bool setAttributeStatus(string attribute, gio.types.FileAttributeStatus status) nothrowSets the attribute status for an attribute key. This is only needed by external code that implement [gio.file.File.setAttributesFromInfo] or similar functions.
void setAttributeString(string attribute, string attrValue) nothrowSets the attribute to contain the given attr_value, if possible.
void setAttributeStringv(string attribute, string[] attrValue) nothrowSets the attribute to contain the given attr_value, if possible.
void setAttributeUint32(string attribute, uint attrValue) nothrowSets the attribute to contain the given attr_value, if possible.
void setAttributeUint64(string attribute, ulong attrValue) nothrowSets the attribute to contain the given attr_value, if possible.
void setContentType(string contentType) nothrowSets the content type attribute for a given #GFileInfo. See [gio.types.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE].
void setCreationDateTime(glib.date_time.DateTime creationTime) nothrowSets the [gio.types.FILE_ATTRIBUTE_TIME_CREATED] and [gio.types.FILE_ATTRIBUTE_TIME_CREATED_USEC] attributes in the file info to the given date/time value.
void setDisplayName(string displayName) nothrowSets the display name for the current #GFileInfo. See [gio.types.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME].
void setEditName(string editName) nothrowSets the edit name for the current file. See [gio.types.FILE_ATTRIBUTE_STANDARD_EDIT_NAME].
void setFileType(gio.types.FileType type) nothrowSets the file type in a #GFileInfo to type. See [gio.types.FILE_ATTRIBUTE_STANDARD_TYPE].
void setIcon(gio.icon.Icon icon) nothrowSets the icon for a given #GFileInfo. See [gio.types.FILE_ATTRIBUTE_STANDARD_ICON].
void setIsHidden(bool isHidden) nothrowSets the "is_hidden" attribute in a #GFileInfo according to is_hidden. See [gio.types.FILE_ATTRIBUTE_STANDARD_IS_HIDDEN].
void setIsSymlink(bool isSymlink) nothrowSets the "is_symlink" attribute in a #GFileInfo according to is_symlink. See [gio.types.FILE_ATTRIBUTE_STANDARD_IS_SYMLINK].
void setModificationDateTime(glib.date_time.DateTime mtime) nothrowSets the [gio.types.FILE_ATTRIBUTE_TIME_MODIFIED] and [gio.types.FILE_ATTRIBUTE_TIME_MODIFIED_USEC] attributes in the file info to the given date/time value.
void setModificationTime(glib.time_val.TimeVal mtime) nothrowSets the [gio.types.FILE_ATTRIBUTE_TIME_MODIFIED] and [gio.types.FILE_ATTRIBUTE_TIME_MODIFIED_USEC] attributes in the file info to the given time value.
void setName(string name) nothrowSets the name attribute for the current #GFileInfo. See [gio.types.FILE_ATTRIBUTE_STANDARD_NAME].
void setSize(long size) nothrowSets the [gio.types.FILE_ATTRIBUTE_STANDARD_SIZE] attribute in the file info to the given size.
void setSortOrder(int sortOrder) nothrowSets the sort order attribute in the file info structure. See [gio.types.FILE_ATTRIBUTE_STANDARD_SORT_ORDER].
void setSymbolicIcon(gio.icon.Icon icon) nothrowSets the symbolic icon for a given #GFileInfo. See [gio.types.FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON].
void setSymlinkTarget(string symlinkTarget) nothrowSets the [gio.types.FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET] attribute in the file info to the given symlink target.
void unsetAttributeMask() nothrowUnsets a mask set by [gio.file_info.FileInfo.setAttributeMask], if one is set.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new file info structure. Returns: a #GFileInfo.

Fluent builder implementation template for gio.file_info.FileInfo

Fluent builder for gio.file_info.FileInfo

Methods
FileInfo build() nothrowCreate object from builder. Returns: New object