Class: Gio::FileInfo

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#attribute_mask=(mask) ⇒ nil

Sets mask on info to match specific attribute types.

Parameters:

  • mask (Gio::FileAttributeMatcher)

    a GFile::AttributeMatcher.

Returns:

  • (nil)

#clear_statusnil

Clears the status information from info.

Returns:

  • (nil)

#content_typeString

Gets the file’s content type.

Returns:

  • (String)

    a string containing the file’s content type.

#content_type=(content_type) ⇒ nil

Sets the content type attribute for a given GFile::Info. See %G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE.

Parameters:

Returns:

  • (nil)

#copy_into(dest_info) ⇒ nil

First clears all of the [GFileAttribute] of dest_info, and then copies all of the file attributes from src_info to dest_info.

Parameters:

  • dest_info (Gio::FileInfo)

    destination to copy attributes to.

Returns:

  • (nil)

#deletion_dateGLib::DateTime

Returns the GDate::Time 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, nil is returned.

Returns:

  • (GLib::DateTime)

    a GDate::Time, or nil.

#display_nameString

Gets a display name for a file.

Returns:

  • (String)

    a string containing the display name.

#display_name=(display_name) ⇒ nil

Sets the display name for the current GFile::Info. See %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.

Parameters:

  • display_name (String)

    a string containing a display name.

Returns:

  • (nil)

#dupGio::FileInfo

Duplicates a file info structure.

Returns:

#edit_nameString

Gets the edit name for a file.

Returns:

  • (String)

    a string containing the edit name.

#edit_name=(edit_name) ⇒ nil

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

Parameters:

  • edit_name (String)

    a string containing an edit name.

Returns:

  • (nil)

#etagString

Gets the [entity tag] for a given GFile::Info. See %G_FILE_ATTRIBUTE_ETAG_VALUE.

Returns:

  • (String)

    a string containing the value of the “etag:value” attribute.

#file_typeGio::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().

Returns:

#file_type=(type) ⇒ nil

Sets the file type in a GFile::Info to type. See %G_FILE_ATTRIBUTE_STANDARD_TYPE.

Parameters:

Returns:

  • (nil)

#get_attribute_as_string(attribute) ⇒ String

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

Parameters:

  • attribute (String)

    a file attribute key.

Returns:

  • (String)

    a UTF-8 string associated with the given attribute, or nil if the attribute wasn’t set. When you’re done with the string it must be freed with g_free().

#get_attribute_boolean(attribute) ⇒ TrueClass

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

Parameters:

  • attribute (String)

    a file attribute key.

Returns:

  • (TrueClass)

    the boolean value contained within the attribute.

#get_attribute_byte_string(attribute) ⇒ String

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

Parameters:

  • attribute (String)

    a file attribute key.

Returns:

  • (String)

    the contents of the attribute value as a byte string, or

#get_attribute_data(attribute, type, value_pp, status) ⇒ TrueClass

Gets the attribute type, value and status for an attribute key.

Parameters:

  • attribute (String)

    a file attribute key

  • type (Gio::FileAttributeType)

    return location for the attribute type, or nil

  • value_pp (GObject)

    return location for the attribute value, or nil; the attribute value will not be nil

  • status (Gio::FileAttributeStatus)

    return location for the attribute status, or nil

Returns:

  • (TrueClass)

    true if info has an attribute named attribute, false otherwise.

#get_attribute_int32(attribute) ⇒ Integer

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.

Parameters:

  • attribute (String)

    a file attribute key.

Returns:

  • (Integer)

    a signed 32-bit integer from the attribute.

#get_attribute_int64(attribute) ⇒ Integer

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.

Parameters:

  • attribute (String)

    a file attribute key.

Returns:

  • (Integer)

    a signed 64-bit integer from the attribute.

#get_attribute_object(attribute) ⇒ GObject::Object

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

Parameters:

  • attribute (String)

    a file attribute key.

Returns:

  • (GObject::Object)

    a #GObject associated with the given attribute, or

#get_attribute_status(attribute) ⇒ Gio::FileAttributeStatus

Gets the attribute status for an attribute key.

Parameters:

  • attribute (String)

    a file attribute key

Returns:

  • (Gio::FileAttributeStatus)

    a GFile::AttributeStatus for the given attribute, or %G_FILE_ATTRIBUTE_STATUS_UNSET if the key is invalid.

#get_attribute_string(attribute) ⇒ String

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

Parameters:

  • attribute (String)

    a file attribute key.

Returns:

  • (String)

    the contents of the attribute value as a UTF-8 string, or

#get_attribute_stringv(attribute) ⇒ Array<String>

Gets the value of a stringv attribute. If the attribute does not contain a stringv, nil will be returned. nil otherwise. Do not free. These returned strings are UTF-8.

Parameters:

  • attribute (String)

    a file attribute key.

Returns:

  • (Array<String>)

    the contents of the attribute value as a stringv, or

#get_attribute_type(attribute) ⇒ Gio::FileAttributeType

Gets the attribute type for an attribute key. %G_FILE_ATTRIBUTE_TYPE_INVALID if the key is not set.

Parameters:

  • attribute (String)

    a file attribute key.

Returns:

#get_attribute_uint32(attribute) ⇒ Integer

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.

Parameters:

  • attribute (String)

    a file attribute key.

Returns:

  • (Integer)

    an unsigned 32-bit integer from the attribute.

#get_attribute_uint64(attribute) ⇒ Integer

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.

Parameters:

  • attribute (String)

    a file attribute key.

Returns:

  • (Integer)

    a unsigned 64-bit integer from the attribute.

#get_modification_time(result) ⇒ nil

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

Parameters:

  • result (GLib::TimeVal)

    a GTime::Val.

Returns:

  • (nil)

#has_attribute(attribute) ⇒ TrueClass

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

Parameters:

  • attribute (String)

    a file attribute key.

Returns:

  • (TrueClass)

    true if info has an attribute named attribute, false otherwise.

#has_namespace(name_space) ⇒ TrueClass

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

Parameters:

  • name_space (String)

    a file attribute namespace.

Returns:

  • (TrueClass)

    true if info has an attribute in name_space, false otherwise.

#iconGio::Icon

Gets the icon for a file.

Returns:

#icon=(icon) ⇒ nil

Sets the icon for a given GFile::Info. See %G_FILE_ATTRIBUTE_STANDARD_ICON.

Parameters:

Returns:

  • (nil)

#is_backupTrueClass

Checks if a file is a backup file.

Returns:

  • (TrueClass)

    true if file is a backup file, false otherwise.

#is_hiddenTrueClass

Checks if a file is hidden.

Returns:

  • (TrueClass)

    true if the file is a hidden file, false otherwise.

#is_hidden=(is_hidden) ⇒ nil

Sets the “is_hidden” attribute in a GFile::Info according to is_hidden. See %G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.

Parameters:

  • is_hidden (TrueClass)

    a #gboolean.

Returns:

  • (nil)

Checks if a file is a symlink.

Returns:

  • (TrueClass)

    true if the given info is a symlink.

#is_symlink=(is_symlink) ⇒ nil

Sets the “is_symlink” attribute in a GFile::Info according to is_symlink. See %G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK.

Parameters:

  • is_symlink (TrueClass)

    a #gboolean.

Returns:

  • (nil)

#list_attributes(name_space) ⇒ Array<String>

Lists the file info structure’s attributes. null-terminated array of strings of all of the possible attribute types for the given name_space, or nil on error.

Parameters:

  • name_space (String)

    a file attribute key’s namespace, or nil to list all attributes.

Returns:

  • (Array<String>)

    a

#modification_date_timeGLib::DateTime

Gets the modification time of the current info and returns it as a GDate::Time.

This requires the %G_FILE_ATTRIBUTE_TIME_MODIFIED attribute. If %G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC is provided, the resulting GDate::Time will have microsecond precision.

Returns:

  • (GLib::DateTime)

    modification time, or nil if unknown

#modification_date_time=(mtime) ⇒ nil

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.

Parameters:

  • mtime (GLib::DateTime)

    a GDate::Time.

Returns:

  • (nil)

#modification_time=(mtime) ⇒ nil

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

Parameters:

  • mtime (GLib::TimeVal)

    a GTime::Val.

Returns:

  • (nil)

#nameGio::filename

Gets the name for a file.

Returns:

  • (Gio::filename)

    a string containing the file name.

#name=(name) ⇒ nil

Sets the name attribute for the current GFile::Info. See %G_FILE_ATTRIBUTE_STANDARD_NAME.

Parameters:

  • name (Gio::filename)

    a string containing a name.

Returns:

  • (nil)

#newGio::FileInfo

Creates a new file info structure.

Returns:

#remove_attribute(attribute) ⇒ nil

Removes all cases of attribute from info if it exists.

Parameters:

  • attribute (String)

    a file attribute key.

Returns:

  • (nil)

#set_attribute(attribute, type, value_p) ⇒ nil

Sets the attribute to contain the given value, if possible. To unset the attribute, use %G_FILE_ATTRIBUTE_TYPE_INVALID for type.

Parameters:

  • attribute (String)

    a file attribute key.

  • type (Gio::FileAttributeType)

    a GFile::AttributeType

  • value_p (GObject)

    pointer to the value

Returns:

  • (nil)

#set_attribute_boolean(attribute, attr_value) ⇒ nil

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

Parameters:

  • attribute (String)

    a file attribute key.

  • attr_value (TrueClass)

    a boolean value.

Returns:

  • (nil)

#set_attribute_byte_string(attribute, attr_value) ⇒ nil

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

Parameters:

  • attribute (String)

    a file attribute key.

  • attr_value (String)

    a byte string.

Returns:

  • (nil)

#set_attribute_int32(attribute, attr_value) ⇒ nil

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

Parameters:

  • attribute (String)

    a file attribute key.

  • attr_value (Integer)

    a signed 32-bit integer

Returns:

  • (nil)

#set_attribute_int64(attribute, attr_value) ⇒ nil

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

Parameters:

  • attribute (String)

    attribute name to set.

  • attr_value (Integer)

    int64 value to set attribute to.

Returns:

  • (nil)

#set_attribute_object(attribute, attr_value) ⇒ nil

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

Parameters:

  • attribute (String)

    a file attribute key.

  • attr_value (GObject::Object)

    a #GObject.

Returns:

  • (nil)

#set_attribute_status(attribute, status) ⇒ TrueClass

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.

The attribute must exist in info for this to work. Otherwise false is returned and info is unchanged.

Parameters:

Returns:

  • (TrueClass)

    true if the status was changed, false if the key was not set.

#set_attribute_string(attribute, attr_value) ⇒ nil

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

Parameters:

  • attribute (String)

    a file attribute key.

  • attr_value (String)

    a UTF-8 string.

Returns:

  • (nil)

#set_attribute_stringv(attribute, attr_value) ⇒ nil

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

Sinze: 2.22

Parameters:

  • attribute (String)

    a file attribute key

  • attr_value (Array<String>)

    a nil terminated array of UTF-8 strings.

Returns:

  • (nil)

#set_attribute_uint32(attribute, attr_value) ⇒ nil

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

Parameters:

  • attribute (String)

    a file attribute key.

  • attr_value (Integer)

    an unsigned 32-bit integer.

Returns:

  • (nil)

#set_attribute_uint64(attribute, attr_value) ⇒ nil

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

Parameters:

  • attribute (String)

    a file attribute key.

  • attr_value (Integer)

    an unsigned 64-bit integer.

Returns:

  • (nil)

#sizeInteger

Gets the file’s size.

Returns:

  • (Integer)

    a #goffset containing the file’s size.

#size=(size) ⇒ nil

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

Parameters:

  • size (Integer)

    a #goffset containing the file’s size.

Returns:

  • (nil)

#sort_orderInteger

Gets the value of the sort_order attribute from the GFile::Info. See %G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER.

Returns:

  • (Integer)

    a #gint32 containing the value of the “standard::sort_order” attribute.

#sort_order=(sort_order) ⇒ nil

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

Parameters:

  • sort_order (Integer)

    a sort order integer.

Returns:

  • (nil)

#symbolic_iconGio::Icon

Gets the symbolic icon for a file.

Returns:

#symbolic_icon=(icon) ⇒ nil

Sets the symbolic icon for a given GFile::Info. See %G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON.

Parameters:

Returns:

  • (nil)

Gets the symlink target for a given GFile::Info.

Returns:

  • (String)

    a string containing the symlink target.

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

Parameters:

  • symlink_target (String)

    a static string containing a path to a symlink target.

Returns:

  • (nil)

#unset_attribute_masknil

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

Returns:

  • (nil)