Interface

Gio-2.0GioFileInterface

Interface for implementing File. Contains only the virtual methods that need to be implemented.

interface Interface {
    vfunc_append_to(
        flags: Gio.FileCreateFlags,
        cancellable?: Gio.Cancellable,
    ): Gio.FileOutputStream;
    vfunc_append_to_async(
        flags: Gio.FileCreateFlags,
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_append_to_finish(res: Gio.AsyncResult): Gio.FileOutputStream;
    vfunc_copy(
        destination: Gio.File,
        flags: Gio.FileCopyFlags,
        cancellable?: Gio.Cancellable,
        progress_callback?: FileProgressCallback,
    ): boolean;
    vfunc_copy_async(
        destination: Gio.File,
        flags: Gio.FileCopyFlags,
        io_priority: number,
        cancellable?: Gio.Cancellable,
        progress_callback?: FileProgressCallback,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_copy_finish(res: Gio.AsyncResult): boolean;
    vfunc_create(
        flags: Gio.FileCreateFlags,
        cancellable?: Gio.Cancellable,
    ): Gio.FileOutputStream;
    vfunc_create_async(
        flags: Gio.FileCreateFlags,
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_create_finish(res: Gio.AsyncResult): Gio.FileOutputStream;
    vfunc_create_readwrite(
        flags: Gio.FileCreateFlags,
        cancellable?: Gio.Cancellable,
    ): Gio.FileIOStream;
    vfunc_create_readwrite_async(
        flags: Gio.FileCreateFlags,
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_create_readwrite_finish(res: Gio.AsyncResult): Gio.FileIOStream;
    vfunc_delete_file(cancellable?: Gio.Cancellable): boolean;
    vfunc_delete_file_async(
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_delete_file_finish(result: Gio.AsyncResult): boolean;
    vfunc_dup(): Gio.File;
    vfunc_eject_mountable(
        flags: Gio.MountUnmountFlags,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_eject_mountable_finish(result: Gio.AsyncResult): boolean;
    vfunc_eject_mountable_with_operation(
        flags: Gio.MountUnmountFlags,
        mount_operation?: Gio.MountOperation,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_eject_mountable_with_operation_finish(
        result: Gio.AsyncResult,
    ): boolean;
    vfunc_enumerate_children(
        attributes: string,
        flags: Gio.FileQueryInfoFlags,
        cancellable?: Gio.Cancellable,
    ): Gio.FileEnumerator;
    vfunc_enumerate_children_async(
        attributes: string,
        flags: Gio.FileQueryInfoFlags,
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_enumerate_children_finish(res: Gio.AsyncResult): Gio.FileEnumerator;
    vfunc_equal(file2: Gio.File): boolean;
    vfunc_find_enclosing_mount(cancellable?: Gio.Cancellable): Gio.Mount;
    vfunc_find_enclosing_mount_async(
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_find_enclosing_mount_finish(res: Gio.AsyncResult): Gio.Mount;
    vfunc_get_basename(): string;
    vfunc_get_child_for_display_name(display_name: string): Gio.File;
    vfunc_get_parent(): Gio.File;
    vfunc_get_parse_name(): string;
    vfunc_get_path(): string;
    vfunc_get_relative_path(descendant: Gio.File): string;
    vfunc_get_uri(): string;
    vfunc_get_uri_scheme(): string;
    vfunc_has_uri_scheme(uri_scheme: string): boolean;
    vfunc_hash(): number;
    vfunc_is_native(): boolean;
    vfunc_make_directory(cancellable?: Gio.Cancellable): boolean;
    vfunc_make_directory_async(
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_make_directory_finish(result: Gio.AsyncResult): boolean;
    vfunc_make_symbolic_link(
        symlink_value: string,
        cancellable?: Gio.Cancellable,
    ): boolean;
    vfunc_make_symbolic_link_async(
        symlink_value: string,
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_make_symbolic_link_finish(result: Gio.AsyncResult): boolean;
    vfunc_measure_disk_usage(
        flags: Gio.FileMeasureFlags,
        cancellable: Gio.Cancellable,
        progress_callback: FileMeasureProgressCallback,
    ): [boolean, number, number, number];
    vfunc_measure_disk_usage_finish(
        result: Gio.AsyncResult,
    ): [boolean, number, number, number];
    vfunc_monitor_dir(
        flags: Gio.FileMonitorFlags,
        cancellable?: Gio.Cancellable,
    ): Gio.FileMonitor;
    vfunc_monitor_file(
        flags: Gio.FileMonitorFlags,
        cancellable?: Gio.Cancellable,
    ): Gio.FileMonitor;
    vfunc_mount_enclosing_volume(
        flags: NONE,
        mount_operation?: Gio.MountOperation,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_mount_enclosing_volume_finish(result: Gio.AsyncResult): boolean;
    vfunc_mount_mountable(
        flags: NONE,
        mount_operation?: Gio.MountOperation,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_mount_mountable_finish(result: Gio.AsyncResult): Gio.File;
    vfunc_move(
        destination: Gio.File,
        flags: Gio.FileCopyFlags,
        cancellable?: Gio.Cancellable,
        progress_callback?: FileProgressCallback,
    ): boolean;
    vfunc_move_async(
        destination: Gio.File,
        flags: Gio.FileCopyFlags,
        io_priority: number,
        cancellable?: Gio.Cancellable,
        progress_callback?: FileProgressCallback,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_move_finish(result: Gio.AsyncResult): boolean;
    vfunc_open_readwrite(cancellable?: Gio.Cancellable): Gio.FileIOStream;
    vfunc_open_readwrite_async(
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_open_readwrite_finish(res: Gio.AsyncResult): Gio.FileIOStream;
    vfunc_poll_mountable(
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_poll_mountable_finish(result: Gio.AsyncResult): boolean;
    vfunc_prefix_matches(file: Gio.File): boolean;
    vfunc_query_exists(cancellable?: Gio.Cancellable): boolean;
    vfunc_query_filesystem_info(
        attributes: string,
        cancellable?: Gio.Cancellable,
    ): Gio.FileInfo;
    vfunc_query_filesystem_info_async(
        attributes: string,
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_query_filesystem_info_finish(res: Gio.AsyncResult): Gio.FileInfo;
    vfunc_query_info(
        attributes: string,
        flags: Gio.FileQueryInfoFlags,
        cancellable?: Gio.Cancellable,
    ): Gio.FileInfo;
    vfunc_query_info_async(
        attributes: string,
        flags: Gio.FileQueryInfoFlags,
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_query_info_finish(res: Gio.AsyncResult): Gio.FileInfo;
    vfunc_query_settable_attributes(
        cancellable?: Gio.Cancellable,
    ): FileAttributeInfoList;
    vfunc_query_writable_namespaces(
        cancellable?: Gio.Cancellable,
    ): FileAttributeInfoList;
    vfunc_read_async(
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_read_finish(res: Gio.AsyncResult): Gio.FileInputStream;
    vfunc_read_fn(cancellable?: Gio.Cancellable): Gio.FileInputStream;
    vfunc_replace(
        etag: string,
        make_backup: boolean,
        flags: Gio.FileCreateFlags,
        cancellable?: Gio.Cancellable,
    ): Gio.FileOutputStream;
    vfunc_replace_async(
        etag: string,
        make_backup: boolean,
        flags: Gio.FileCreateFlags,
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_replace_finish(res: Gio.AsyncResult): Gio.FileOutputStream;
    vfunc_replace_readwrite(
        etag: string,
        make_backup: boolean,
        flags: Gio.FileCreateFlags,
        cancellable?: Gio.Cancellable,
    ): Gio.FileIOStream;
    vfunc_replace_readwrite_async(
        etag: string,
        make_backup: boolean,
        flags: Gio.FileCreateFlags,
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_replace_readwrite_finish(res: Gio.AsyncResult): Gio.FileIOStream;
    vfunc_resolve_relative_path(relative_path: string): Gio.File;
    vfunc_set_attribute(
        attribute: string,
        type: Gio.FileAttributeType,
        value_p: any,
        flags: Gio.FileQueryInfoFlags,
        cancellable?: Gio.Cancellable,
    ): boolean;
    vfunc_set_attributes_async(
        info: Gio.FileInfo,
        flags: Gio.FileQueryInfoFlags,
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_set_attributes_finish(
        result: Gio.AsyncResult,
    ): [boolean, Gio.FileInfo];
    vfunc_set_attributes_from_info(
        info: Gio.FileInfo,
        flags: Gio.FileQueryInfoFlags,
        cancellable?: Gio.Cancellable,
    ): boolean;
    vfunc_set_display_name(
        display_name: string,
        cancellable?: Gio.Cancellable,
    ): Gio.File;
    vfunc_set_display_name_async(
        display_name: string,
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_set_display_name_finish(res: Gio.AsyncResult): Gio.File;
    vfunc_start_mountable(
        flags: NONE,
        start_operation?: Gio.MountOperation,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_start_mountable_finish(result: Gio.AsyncResult): boolean;
    vfunc_stop_mountable(
        flags: Gio.MountUnmountFlags,
        mount_operation?: Gio.MountOperation,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_stop_mountable_finish(result: Gio.AsyncResult): boolean;
    vfunc_trash(cancellable?: Gio.Cancellable): boolean;
    vfunc_trash_async(
        io_priority: number,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_trash_finish(result: Gio.AsyncResult): boolean;
    vfunc_unmount_mountable(
        flags: Gio.MountUnmountFlags,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_unmount_mountable_finish(result: Gio.AsyncResult): boolean;
    vfunc_unmount_mountable_with_operation(
        flags: Gio.MountUnmountFlags,
        mount_operation?: Gio.MountOperation,
        cancellable?: Gio.Cancellable,
        callback?: AsyncReadyCallback<Gio.File.Interface>,
    ): void;
    vfunc_unmount_mountable_with_operation_finish(
        result: Gio.AsyncResult,
    ): boolean;
}

Hierarchy (View Summary)

Index

Methods

vfunc_append_to vfunc_append_to_async vfunc_append_to_finish vfunc_copy vfunc_copy_async vfunc_copy_finish vfunc_create vfunc_create_async vfunc_create_finish vfunc_create_readwrite vfunc_create_readwrite_async vfunc_create_readwrite_finish vfunc_delete_file vfunc_delete_file_async vfunc_delete_file_finish vfunc_dup vfunc_eject_mountable vfunc_eject_mountable_finish vfunc_eject_mountable_with_operation vfunc_eject_mountable_with_operation_finish vfunc_enumerate_children vfunc_enumerate_children_async vfunc_enumerate_children_finish vfunc_equal vfunc_find_enclosing_mount vfunc_find_enclosing_mount_async vfunc_find_enclosing_mount_finish vfunc_get_basename vfunc_get_child_for_display_name vfunc_get_parent vfunc_get_parse_name vfunc_get_path vfunc_get_relative_path vfunc_get_uri vfunc_get_uri_scheme vfunc_has_uri_scheme vfunc_hash vfunc_is_native vfunc_make_directory vfunc_make_directory_async vfunc_make_directory_finish vfunc_make_symbolic_link vfunc_make_symbolic_link_async vfunc_make_symbolic_link_finish vfunc_measure_disk_usage vfunc_measure_disk_usage_finish vfunc_monitor_dir vfunc_monitor_file vfunc_mount_enclosing_volume vfunc_mount_enclosing_volume_finish vfunc_mount_mountable vfunc_mount_mountable_finish vfunc_move vfunc_move_async vfunc_move_finish vfunc_open_readwrite vfunc_open_readwrite_async vfunc_open_readwrite_finish vfunc_poll_mountable vfunc_poll_mountable_finish vfunc_prefix_matches vfunc_query_exists vfunc_query_filesystem_info vfunc_query_filesystem_info_async vfunc_query_filesystem_info_finish vfunc_query_info vfunc_query_info_async vfunc_query_info_finish vfunc_query_settable_attributes vfunc_query_writable_namespaces vfunc_read_async vfunc_read_finish vfunc_read_fn vfunc_replace vfunc_replace_async vfunc_replace_finish vfunc_replace_readwrite vfunc_replace_readwrite_async vfunc_replace_readwrite_finish vfunc_resolve_relative_path vfunc_set_attribute vfunc_set_attributes_async vfunc_set_attributes_finish vfunc_set_attributes_from_info vfunc_set_display_name vfunc_set_display_name_async vfunc_set_display_name_finish vfunc_start_mountable vfunc_start_mountable_finish vfunc_stop_mountable vfunc_stop_mountable_finish vfunc_trash vfunc_trash_async vfunc_trash_finish vfunc_unmount_mountable vfunc_unmount_mountable_finish vfunc_unmount_mountable_with_operation vfunc_unmount_mountable_with_operation_finish

Methods

  • Deletes a file. If the file is a directory, it will only be deleted if it is empty. This has the same semantics as g_unlink().

    If file doesn’t exist, Gio.IOErrorEnum.NOT_FOUND will be returned. This allows for deletion to be implemented avoiding time-of-check to time-of-use races:

    g_autoptr(GError) local_error = NULL;
    if (!g_file_delete (my_file, my_cancellable, &local_error) &&
    !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
    {
    // deletion failed for some reason other than the file not existing:
    // so report the error
    g_warning ("Failed to delete %s: %s",
    g_file_peek_path (my_file), local_error->message);
    }

    If cancellable is not null, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.

    Parameters

    Returns boolean

  • Duplicates a Gio.File handle. This operation does not duplicate the actual file or directory represented by the Gio.File; see g_file_copy() if attempting to copy a file.

    g_file_dup() is useful when a second handle is needed to the same underlying file, for use in a separate thread (Gio.File is not thread-safe). For use within the same thread, use g_object_ref() to increment the existing object’s reference count.

    This call does no blocking I/O.

    Returns Gio.File

  • Checks if the two given GFiles refer to the same file.

    This function can be used with Gio.File.hash to insert Gio.Files efficiently in a hash table.

    Note that two GFiles that differ can still refer to the same file on the filesystem due to various forms of filename aliasing. For local files, this function essentially compares the file paths, so two Gio.Files which point to different hard or soft links will not be considered equal, despite pointing to the same content.

    For determining whether two files are hardlinked, see Gio.FILE_ATTRIBUTE_ID_FILE.

    This call does no blocking I/O.

    Parameters

    Returns boolean

  • Gets the base name (the last component of the path) for a given Gio.File.

    If called for the top level of a system (such as the filesystem root or a uri like sftp://host/) it will return a single directory separator (and on Windows, possibly a drive letter).

    The base name is a byte string (not UTF-8). It has no defined encoding or rules other than it may not contain zero bytes. If you want to use filenames in a user interface you should use the display name that you can get by requesting the G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with g_file_query_info().

    This call does no blocking I/O.

    Returns string

  • Gets the child of file for a given display_name (i.e. a UTF-8 version of the name). If this function fails, it returns null and error will be set. This is very useful when constructing a Gio.File for a new file and the user entered the filename in the user interface, for instance when you select a directory and type a filename in the file selector.

    This call does no blocking I/O.

    Parameters

    • display_name: string

      string to a possible child

    Returns Gio.File

  • Gets the parent directory for the file. If the file represents the root directory of the file system, then null will be returned.

    This call does no blocking I/O.

    Returns Gio.File

  • Gets the parse name of the file. A parse name is a UTF-8 string that describes the file such that one can get the Gio.File back using g_file_parse_name().

    This is generally used to show the Gio.File as a nice full-pathname kind of string in a user interface, like in a location entry.

    For local files with names that can safely be converted to UTF-8 the pathname is used, otherwise the IRI is used (a form of URI that allows UTF-8 characters unescaped).

    This call does no blocking I/O.

    Returns string

  • Gets the local pathname for Gio.File, if one exists. If non-null, this is guaranteed to be an absolute, canonical path. It might contain symlinks.

    This call does no blocking I/O.

    Returns string

  • Gets the URI for the file.

    This call does no blocking I/O.

    Returns string

  • Gets the URI scheme for a Gio.File. RFC 3986 decodes the scheme as:

    URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
    

    Common schemes include "file", "http", "ftp", etc.

    The scheme can be different from the one used to construct the Gio.File, in that it might be replaced with one that is logically equivalent to the Gio.File.

    This call does no blocking I/O.

    Returns string

  • Checks to see if a Gio.File has a given URI scheme.

    This call does no blocking I/O.

    Parameters

    • uri_scheme: string

      a string containing a URI scheme

    Returns boolean

  • Checks to see if a file is native to the platform.

    A native file is one expressed in the platform-native filename format, e.g. "C:\Windows" or "/usr/bin/". This does not mean the file is local, as it might be on a locally mounted remote filesystem.

    On some systems non-native files may be available using the native filesystem via a userspace filesystem (FUSE), in these cases this call will return false, but g_file_get_path() will still return a native path.

    This call does no blocking I/O.

    Returns boolean

  • Creates a directory.

    Note that this will only create a child directory of the immediate parent directory of the path or URI given by the Gio.File. To recursively create directories, see g_file_make_directory_with_parents().

    This function will fail if the parent directory does not exist, setting error to Gio.IOErrorEnum.NOT_FOUND. If the file system doesn't support creating directories, this function will fail, setting error to Gio.IOErrorEnum.NOT_SUPPORTED. If the directory already exists, Gio.IOErrorEnum.EXISTS will be returned.

    For a local Gio.File the newly created directory will have the default (current) ownership and permissions of the current process.

    If cancellable is not null, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.

    Parameters

    Returns boolean

  • Creates a symbolic link named file which contains the string symlink_value.

    If cancellable is not null, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.

    Parameters

    • symlink_value: string

      a string with the path for the target of the new symlink

    • Optionalcancellable: Gio.Cancellable

      optional Gio.Cancellable object, null to ignore

    Returns boolean

  • Opens an existing file for reading and writing. The result is a Gio.FileIOStream that can be used to read and write the contents of the file.

    If cancellable is not null, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.

    If the file does not exist, the Gio.IOErrorEnum.NOT_FOUND error will be returned. If the file is a directory, the Gio.IOErrorEnum.IS_DIRECTORY error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on. Note that in many non-local file cases read and write streams are not supported, so make sure you really need to do read and write streaming, rather than just opening for reading or writing.

    Parameters

    Returns Gio.FileIOStream

  • Checks whether file has the prefix specified by prefix.

    In other words, if the names of initial elements of file's pathname match prefix. Only full pathname elements are matched, so a path like /foo is not considered a prefix of /foobar, only of /foo/bar.

    A Gio.File is not a prefix of itself. If you want to check for equality, use g_file_equal().

    This call does no I/O, as it works purely on names. As such it can sometimes return false even if file is inside a prefix (from a filesystem point of view), because the prefix of file is an alias of prefix.

    Parameters

    Returns boolean

  • Utility function to check if a particular file exists.

    The fallback implementation of this API is using Gio.File.query_info and therefore may do blocking I/O. To asynchronously query the existence of a file, use Gio.File.query_info_async.

    Note that in many cases it is racy to first check for file existence and then execute something based on the outcome of that, because the file might have been created or removed in between the operations. The general approach to handling that is to not check, but just do the operation and handle the errors as they come.

    As an example of race-free checking, take the case of reading a file, and if it doesn't exist, creating it. There are two racy versions: read it, and on error create it; and: check if it exists, if not create it. These can both result in two processes creating the file (with perhaps a partially written file as the result). The correct approach is to always try to create the file with g_file_create() which will either atomically create the file or fail with a Gio.IOErrorEnum.EXISTS error.

    However, in many cases an existence check is useful in a user interface, for instance to make a menu item sensitive/insensitive, so that you don't have to fool users that something is possible and then just show an error dialog. If you do this, you should make sure to also handle the errors that can happen due to races when you execute the operation.

    Parameters

    Returns boolean

  • Similar to g_file_query_info(), but obtains information about the filesystem the file is on, rather than the file itself. For instance the amount of space available and the type of the filesystem.

    The attributes value is a string that specifies the attributes that should be gathered. It is not an error if it's not possible to read a particular requested attribute from a file - it just won't be set. attributes should be a comma-separated list of attributes or attribute wildcards. The wildcard "*" means all attributes, and a wildcard like "filesystem::*" means all attributes in the filesystem namespace. The standard namespace for filesystem attributes is "filesystem". Common attributes of interest are G_FILE_ATTRIBUTE_FILESYSTEM_SIZE (the total size of the filesystem in bytes), G_FILE_ATTRIBUTE_FILESYSTEM_FREE (number of bytes available), and G_FILE_ATTRIBUTE_FILESYSTEM_TYPE (type of the filesystem).

    If cancellable is not null, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.

    If the file does not exist, the Gio.IOErrorEnum.NOT_FOUND error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

    Parameters

    Returns Gio.FileInfo

  • Asynchronously gets the requested information about the filesystem that the specified file is on. The result is a Gio.FileInfo object that contains key-value attributes (such as type or size for the file).

    For more details, see g_file_query_filesystem_info() which is the synchronous version of this call.

    When the operation is finished, callback will be called. You can then call g_file_query_info_finish() to get the result of the operation.

    Parameters

    Returns void

  • Gets the requested information about specified file.

    The result is a Gio.FileInfo object that contains key-value attributes (such as the type or size of the file).

    The attributes value is a string that specifies the file attributes that should be gathered. It is not an error if it’s not possible to read a particular requested attribute from a file — it just won't be set. In particular this means that if a file is inaccessible (due to being in a folder with restrictive permissions), for example, you can expect the returned Gio.FileInfo to have very few attributes set. You should check whether an attribute is set using Gio.FileInfo.has_attribute before trying to retrieve its value.

    It is guaranteed that if any of the following attributes are listed in attributes, they will always be set in the returned Gio.FileInfo, even if the user doesn’t have permissions to access the file:

    attributes should be a comma-separated list of attributes or attribute wildcards. The wildcard "\*" means all attributes, and a wildcard like "standard::*" means all attributes in the standard namespace. An example attribute query might be "standard::*,owner::user". The standard attributes are available as defines, like Gio.FILE_ATTRIBUTE_STANDARD_NAME.

    If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.

    For symlinks, normally the information about the target of the symlink is returned, rather than information about the symlink itself. However if you pass Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS in flags the information about the symlink itself will be returned. Also, for symlinks that point to non-existing files the information about the symlink itself will be returned.

    If the file does not exist, the Gio.IOErrorEnum.NOT_FOUND error will be returned. Other errors are possible too, and depend on what kind of file system the file is on.

    Parameters

    Returns Gio.FileInfo

  • Obtain the list of settable attributes for the file.

    Returns the type and full attribute name of all the attributes that can be set on this file. This doesn't mean setting it will always succeed though, you might get an access failure, or some specific file may not support a specific attribute.

    If cancellable is not null, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.

    Parameters

    Returns FileAttributeInfoList

  • Returns an output stream for overwriting the file, possibly creating a backup copy of the file first. If the file doesn't exist, it will be created.

    This will try to replace the file in the safest way possible so that any errors during the writing will not affect an already existing copy of the file. For instance, for local files it may write to a temporary file and then atomically rename over the destination when the stream is closed.

    By default files created are generally readable by everyone, but if you pass Gio.FileCreateFlags.PRIVATE in flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.

    If cancellable is not null, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.

    If you pass in a non-null etag value and file already exists, then this value is compared to the current entity tag of the file, and if they differ an Gio.IOErrorEnum.WRONG_ETAG error is returned. This generally means that the file has been changed since you last read it. You can get the new etag from g_file_output_stream_get_etag() after you've finished writing and closed the Gio.FileOutputStream. When you load a new file you can use g_file_input_stream_query_info() to get the etag of the file.

    If make_backup is true, this function will attempt to make a backup of the current file before overwriting it. If this fails a Gio.IOErrorEnum.CANT_CREATE_BACKUP error will be returned. If you want to replace anyway, try again with make_backup set to false.

    If the file is a directory the Gio.IOErrorEnum.IS_DIRECTORY error will be returned, and if the file is some other form of non-regular file then a Gio.IOErrorEnum.NOT_REGULAR_FILE error will be returned. Some file systems don't allow all file names, and may return an Gio.IOErrorEnum.INVALID_FILENAME error, and if the name is to long Gio.IOErrorEnum.FILENAME_TOO_LONG will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

    Parameters

    Returns Gio.FileOutputStream

  • Returns an output stream for overwriting the file in readwrite mode, possibly creating a backup copy of the file first. If the file doesn't exist, it will be created.

    For details about the behaviour, see g_file_replace() which does the same thing but returns an output stream only.

    Note that in many non-local file cases read and write streams are not supported, so make sure you really need to do read and write streaming, rather than just opening for reading or writing.

    Parameters

    Returns Gio.FileIOStream

  • Resolves a relative path for file to an absolute path.

    This call does no blocking I/O.

    If the relative_path is an absolute path name, the resolution is done absolutely (without taking file path as base).

    Parameters

    • relative_path: string

      a given relative path string

    Returns Gio.File

  • Renames file to the specified display name.

    The display name is converted from UTF-8 to the correct encoding for the target filesystem if possible and the file is renamed to this.

    If you want to implement a rename operation in the user interface the edit name (G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME) should be used as the initial value in the rename widget, and then the result after editing should be passed to g_file_set_display_name().

    On success the resulting converted filename is returned.

    If cancellable is not null, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.

    Parameters

    Returns Gio.File

  • Sends file to the "Trashcan", if possible. This is similar to deleting it, but the user can recover it before emptying the trashcan. Trashing is disabled for system mounts by default (see g_unix_mount_entry_is_system_internal()), so this call can return the Gio.IOErrorEnum.NOT_SUPPORTED error. Since GLib 2.66, the x-gvfs-notrash unix mount option can be used to disable g_file_trash() support for particular mounts, the Gio.IOErrorEnum.NOT_SUPPORTED error will be returned in that case. Since 2.82, the x-gvfs-trash unix mount option can be used to enable g_file_trash() support for particular system mounts.

    If cancellable is not null, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.

    Parameters

    Returns boolean

  • Finishes an unmount operation, see g_file_unmount_mountable_with_operation() for details.

    Finish an asynchronous unmount operation that was started with g_file_unmount_mountable_with_operation().

    Parameters

    Returns boolean