Functionality for manipulating basic metadata for files. Glib.File_Info.Gfile_Info implements methods for getting information that all files should contain, and allows for manipulation of extended attributes.
See [GFileAttribute][gio-GFileAttribute] for more information on how GIO handles file attributes.
To obtain a Glib.File_Info.Gfile_Info for a Glib.GFile.Gfile, use Glib.GFile.Query_Info (or its async variant). To obtain a Glib.File_Info.Gfile_Info for a file input or output stream, use Glib.File_Input_Stream.Query_Info or Glib.File_Output_Stream.Query_Info (or their async variants).
To change the actual attributes of a file, you should then set the attribute in the Glib.File_Info.Gfile_Info and call Glib.GFile.Set_Attributes_From_Info or Glib.GFile.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 Glib.File_Info.Set_Size. You may call g_file_query_settable_attributes and g_file_query_writable_namespaces to discover the settable attributes of a particular file at runtime.
The direct accessors, such as Glib.File_Info.Get_Name, are slightly more optimized than the generic attribute accessors, such as Glib.File_Info.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 Glib.File_Info.Gfile_Info. Use Glib.File_Info.Has_Attribute or Glib.File_Info.List_Attributes to check what attributes are specified for a Glib.File_Info.Gfile_Info.
Gfile.Attribute_Matcher.Gfile_Attribute_Matcher allows for searching through a Glib.File_Info.Gfile_Info for attributes.
procedure Clear_Status (Self : not null access Gfile_Info_Record)
Clears the status information from Info.
procedure Copy_Into
(Self : not null access Gfile_Info_Record;
Dest_Info : not null access Gfile_Info_Record'Class)
First clears all of the [GFileAttribute][gio-GFileAttribute] of Dest_Info, and then copies all of the file attributes from Src_Info to Dest_Info.
destination to copy attributes to.
function Dup (Self : not null access Gfile_Info_Record) return Gfile_Info
Duplicates a file info structure.
a duplicate Glib.File_Info.Gfile_Info of Other. Has transfer-ownership='full'.
procedure G_New (Self : out Gfile_Info)
Creates a new file info structure.
function Get_Attribute_As_String
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String) return UTF8_String
Gets the value of an attribute, formatted as a string. This escapes things as needed to make the string valid UTF-8.
a file attribute key.
a UTF-8 string associated with the given Attribute, or null if the attribute wasn't set. When you're done with the string it must be freed with g_free.
function Get_Attribute_Boolean
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String) return Boolean
Gets the value of a boolean attribute. If the attribute does not contain a boolean value, False will be returned.
a file attribute key.
the boolean value contained within the attribute.
function Get_Attribute_Byte_String
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String) return UTF8_String
Gets the value of a byte string attribute. If the attribute does not contain a byte string, null will be returned.
a file attribute key.
the contents of the Attribute value as a byte string, or null otherwise.
function Get_Attribute_File_Path
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String) return UTF8_String
Gets the value of a byte string attribute as a file path. If the attribute does not contain a byte string, NULL will be returned. This function is meant to be used by language bindings that have specific handling for Unix paths. Since: gtk+ 2.78
a file attribute key.
the contents of the Attribute value as a file path, or null otherwise.
function Get_Attribute_Int32
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String) return Gint32
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.
a file attribute key.
a signed 32-bit integer from the attribute.
function Get_Attribute_Int64
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String) return Gint64
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.
a file attribute key.
a signed 64-bit integer from the attribute.
function Get_Attribute_Object
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String) return Glib.Object.GObject
Gets the value of a Glib.Object.GObject attribute. If the attribute does not contain a Glib.Object.GObject, null will be returned.
a file attribute key.
a Glib.Object.GObject associated with the given Attribute, or null otherwise. Has transfer-ownership='none'.
function Get_Attribute_String
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String) return UTF8_String
Gets the value of a string attribute. If the attribute does not contain a string, null will be returned.
a file attribute key.
the contents of the Attribute value as a UTF-8 string, or null otherwise.
function Get_Attribute_Stringv
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String) return GNAT.Strings.String_List
Gets the value of a stringv attribute. If the attribute does not contain a stringv, null will be returned. Since: gtk+ 2.22
a file attribute key.
the contents of the Attribute value as a stringv, or null otherwise. Do not free. These returned strings are UTF-8.
function Get_Attribute_Uint32
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String) return Guint32
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.
a file attribute key.
an unsigned 32-bit integer from the attribute.
function Get_Attribute_Uint64
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String) return Guint64
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.
a file attribute key.
a unsigned 64-bit integer from the attribute.
function Get_Content_Type
(Self : not null access Gfile_Info_Record) return UTF8_String
Gets the file's content type. It is an error to call this if the Glib.File_Info.Gfile_Info does not contain G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE.
a string containing the file's content type, or null if unknown.
function Get_Display_Name
(Self : not null access Gfile_Info_Record) return UTF8_String
Gets a display name for a file. This is guaranteed to always be set. It is an error to call this if the Glib.File_Info.Gfile_Info does not contain G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.
a string containing the display name.
function Get_Edit_Name
(Self : not null access Gfile_Info_Record) return UTF8_String
Gets the edit name for a file. It is an error to call this if the Glib.File_Info.Gfile_Info does not contain G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME.
a string containing the edit name.
function Get_Etag
(Self : not null access Gfile_Info_Record) return UTF8_String
Gets the [entity tag][gfile-etag] for a given Glib.File_Info.Gfile_Info. See G_FILE_ATTRIBUTE_ETAG_VALUE. It is an error to call this if the Glib.File_Info.Gfile_Info does not contain G_FILE_ATTRIBUTE_ETAG_VALUE.
a string containing the value of the "etag:value" attribute.
function Get_File_Type
(Self : not null access Gfile_Info_Record) return GFile_Type
Gets a file's type (whether it is a regular file, symlink, etc). This is different from the file's content type, see Glib.File_Info.Get_Content_Type. It is an error to call this if the Glib.File_Info.Gfile_Info does not contain G_FILE_ATTRIBUTE_STANDARD_TYPE.
a Glib.File_Info.GFile_Type for the given file.
function Get_Icon
(Self : not null access Gfile_Info_Record) return Glib.G_Icon.G_Icon
Gets the icon for a file. It is an error to call this if the Glib.File_Info.Gfile_Info does not contain G_FILE_ATTRIBUTE_STANDARD_ICON.
Glib.G_Icon.G_Icon for the given Info.
function Get_Is_Backup
(Self : not null access Gfile_Info_Record) return Boolean
Checks if a file is a backup file. It is an error to call this if the Glib.File_Info.Gfile_Info does not contain G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP.
True if file is a backup file, False otherwise.
function Get_Is_Hidden
(Self : not null access Gfile_Info_Record) return Boolean
Checks if a file is hidden. It is an error to call this if the Glib.File_Info.Gfile_Info does not contain G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.
True if the file is a hidden file, False otherwise.
function Get_Is_Symlink
(Self : not null access Gfile_Info_Record) return Boolean
Checks if a file is a symlink. It is an error to call this if the Glib.File_Info.Gfile_Info does not contain G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.
True if the given Info is a symlink.
function Get_Name
(Self : not null access Gfile_Info_Record) return UTF8_String
Gets the name for a file. This is guaranteed to always be set. It is an error to call this if the Glib.File_Info.Gfile_Info does not contain G_FILE_ATTRIBUTE_STANDARD_NAME.
a string containing the file name.
function Get_Size
(Self : not null access Gfile_Info_Record) return Glib.Gint64
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. It is an error to call this if the Glib.File_Info.Gfile_Info does not contain G_FILE_ATTRIBUTE_STANDARD_SIZE.
a goffset containing the file's size (in bytes).
function Get_Sort_Order
(Self : not null access Gfile_Info_Record) return Gint32
Gets the value of the sort_order attribute from the Glib.File_Info.Gfile_Info. See G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER. It is an error to call this if the Glib.File_Info.Gfile_Info does not contain G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.
a Gint32 containing the value of the "standard::sort_order" attribute.
function Get_Symbolic_Icon
(Self : not null access Gfile_Info_Record) return Glib.G_Icon.G_Icon
Gets the symbolic icon for a file. It is an error to call this if the Glib.File_Info.Gfile_Info does not contain G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON. Since: gtk+ 2.34
Glib.G_Icon.G_Icon for the given Info.
function Get_Symlink_Target
(Self : not null access Gfile_Info_Record) return UTF8_String
Gets the symlink target for a given Glib.File_Info.Gfile_Info. It is an error to call this if the Glib.File_Info.Gfile_Info does not contain G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET.
a string containing the symlink target.
function Get_Type return Glib.GType
type Gfile_Info is access all Gfile_Info_Record'Class;
function Gfile_Info_New return Gfile_Info
Creates a new file info structure.
type Gfile_Info_Record is new GObject_Record with null record;
type GFile_Type is (
G_File_Type_Unknown,
G_File_Type_Regular,
G_File_Type_Directory,
G_File_Type_Symbolic_Link,
G_File_Type_Special,
G_File_Type_Shortcut,
G_File_Type_Mountable);
Indicates the file's on-disk type.
On Windows systems a file will never have Glib.File_Info.G_File_Type_Symbolic_Link type; use Glib.File_Info.Gfile_Info and G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK to determine whether a file is a symlink or not. This is due to the fact that NTFS does not have a single filesystem object type for symbolic links - it has files that symlink to files, and directories that symlink to directories. Glib.File_Info.GFile_Type enumeration cannot precisely represent this important distinction, which is why all Windows symlinks will continue to be reported as Glib.File_Info.G_File_Type_Regular or Glib.File_Info.G_File_Type_Directory.
package GFile_Type_Properties is
new Generic_Internal_Discrete_Property (GFile_Type);
function Has_Attribute
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String) return Boolean
Checks if a file info structure has an attribute named Attribute.
a file attribute key.
True if Info has an attribute named Attribute, False otherwise.
function Has_Namespace
(Self : not null access Gfile_Info_Record;
Name_Space : UTF8_String) return Boolean
Checks if a file info structure has an attribute in the specified Name_Space. Since: gtk+ 2.22
a file attribute namespace.
True if Info has an attribute in Name_Space, False otherwise.
procedure Initialize (Self : not null access Gfile_Info_Record'Class)
Creates a new file info structure. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
function List_Attributes
(Self : not null access Gfile_Info_Record;
Name_Space : UTF8_String := "") return GNAT.Strings.String_List
Lists the file info structure's attributes.
a file attribute key's namespace, or null to list all attributes.
a null-terminated array of strings of all of the possible attribute types for the given Name_Space, or null on error.
type Property_GFile_Type is new GFile_Type_Properties.Property;
procedure Remove_Attribute
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String)
Removes all cases of Attribute from Info if it exists.
a file attribute key.
procedure Set_Attribute_Boolean
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String;
Attr_Value : Boolean)
Sets the Attribute to contain the given Attr_Value, if possible.
a file attribute key.
a boolean value.
procedure Set_Attribute_Byte_String
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String;
Attr_Value : UTF8_String)
Sets the Attribute to contain the given Attr_Value, if possible.
a file attribute key.
a byte string.
procedure Set_Attribute_File_Path
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String;
Attr_Value : UTF8_String)
Sets the Attribute to contain the given Attr_Value, if possible. This function is meant to be used by language bindings that have specific handling for Unix paths. Since: gtk+ 2.78
a file attribute key.
a file path.
procedure Set_Attribute_Int32
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String;
Attr_Value : Gint32)
Sets the Attribute to contain the given Attr_Value, if possible.
a file attribute key.
a signed 32-bit integer
procedure Set_Attribute_Int64
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String;
Attr_Value : Gint64)
Sets the Attribute to contain the given Attr_Value, if possible.
attribute name to set.
int64 value to set attribute to.
procedure Set_Attribute_Object
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String;
Attr_Value : not null access Glib.Object.GObject_Record'Class)
Sets the Attribute to contain the given Attr_Value, if possible.
a file attribute key.
a Glib.Object.GObject.
procedure Set_Attribute_String
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String;
Attr_Value : UTF8_String)
Sets the Attribute to contain the given Attr_Value, if possible.
a file attribute key.
a UTF-8 string.
procedure Set_Attribute_Stringv
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String;
Attr_Value : GNAT.Strings.String_List)
Sets the Attribute to contain the given Attr_Value, if possible. Sinze: 2.22
a file attribute key
a null terminated array of UTF-8 strings.
procedure Set_Attribute_Uint32
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String;
Attr_Value : Guint32)
Sets the Attribute to contain the given Attr_Value, if possible.
a file attribute key.
an unsigned 32-bit integer.
procedure Set_Attribute_Uint64
(Self : not null access Gfile_Info_Record;
Attribute : UTF8_String;
Attr_Value : Guint64)
Sets the Attribute to contain the given Attr_Value, if possible.
a file attribute key.
an unsigned 64-bit integer.
procedure Set_Content_Type
(Self : not null access Gfile_Info_Record;
Content_Type : UTF8_String)
Sets the content type attribute for a given Glib.File_Info.Gfile_Info. See G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE.
a content type. See [GContentType][gio-GContentType]
procedure Set_Display_Name
(Self : not null access Gfile_Info_Record;
Display_Name : UTF8_String)
Sets the display name for the current Glib.File_Info.Gfile_Info. See G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.
a string containing a display name.
procedure Set_Edit_Name
(Self : not null access Gfile_Info_Record;
Edit_Name : UTF8_String)
Sets the edit name for the current file. See G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME.
a string containing an edit name.
procedure Set_File_Type
(Self : not null access Gfile_Info_Record;
The_Type : GFile_Type)
Sets the file type in a Glib.File_Info.Gfile_Info to Type. See G_FILE_ATTRIBUTE_STANDARD_TYPE.
a Glib.File_Info.GFile_Type.
procedure Set_Icon
(Self : not null access Gfile_Info_Record;
Icon : Glib.G_Icon.G_Icon)
Sets the icon for a given Glib.File_Info.Gfile_Info. See G_FILE_ATTRIBUTE_STANDARD_ICON.
a Glib.G_Icon.G_Icon.
procedure Set_Is_Hidden
(Self : not null access Gfile_Info_Record;
Is_Hidden : Boolean)
Sets the "is_hidden" attribute in a Glib.File_Info.Gfile_Info according to Is_Hidden. See G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.
a Boolean.
procedure Set_Is_Symlink
(Self : not null access Gfile_Info_Record;
Is_Symlink : Boolean)
Sets the "is_symlink" attribute in a Glib.File_Info.Gfile_Info according to Is_Symlink. See G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.
a Boolean.
procedure Set_Name
(Self : not null access Gfile_Info_Record;
Name : UTF8_String)
Sets the name attribute for the current Glib.File_Info.Gfile_Info. See G_FILE_ATTRIBUTE_STANDARD_NAME.
a string containing a name.
procedure Set_Size
(Self : not null access Gfile_Info_Record;
Size : Glib.Gint64)
Sets the G_FILE_ATTRIBUTE_STANDARD_SIZE attribute in the file info to the given size.
a goffset containing the file's size.
procedure Set_Sort_Order
(Self : not null access Gfile_Info_Record;
Sort_Order : Gint32)
Sets the sort order attribute in the file info structure. See G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.
a sort order integer.
procedure Set_Symbolic_Icon
(Self : not null access Gfile_Info_Record;
Icon : Glib.G_Icon.G_Icon)
Sets the symbolic icon for a given Glib.File_Info.Gfile_Info. See G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON. Since: gtk+ 2.34
a Glib.G_Icon.G_Icon.
procedure Set_Symlink_Target
(Self : not null access Gfile_Info_Record;
Symlink_Target : UTF8_String)
Sets the G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET attribute in the file info to the given symlink target.
a static string containing a path to a symlink target.
procedure Unset_Attribute_Mask (Self : not null access Gfile_Info_Record)
Unsets a mask set by g_file_info_set_attribute_mask, if one is set.