
Gnome::Gio::R-File
Description
Gnome::Gio::R-File is a high level abstraction for manipulating files on a virtual file system. GFiles are lightweight, immutable objects that do no I/O upon creation. It is necessary to understand that Gnome::Gio::R-File objects do not represent files, merely an identifier for a file. All file content I/O is implemented as streaming operations (see Gnome::Gio::InputStream and Gnome::Gio::OutputStream).
To construct a Gnome::Gio::R-File, you can use:
.new-for-path()
if you have a path..new-for-uri()
if you have a URI..new-for-commandline-arg()
for a command line argument..new-tmp()
to create a temporary file from a template..parse-name()
from a UTF-8 string gotten from.get-parse-name()
..new-build-filename()
to create a file from path elements.
One way to think of a Gnome::Gio::R-File is as an abstraction of a pathname. For normal files the system pathname is what is stored internally, but as GFiles are extensible it could also be something else that corresponds to a pathname in a userspace implementation of a filesystem.
GFiles make up hierarchies of directories and files that correspond to the files on a filesystem. You can move through the file system with Gnome::Gio::R-File using .get-parent()
to get an identifier for the parent directory, .get-child()
to get a child within a directory, .resolve-relative-path()
to resolve a relative path between two GFiles. There can be multiple hierarchies, so you may not end up at the same root if you repeatedly call .get-parent()
on two different files.
All GFiles have a basename (get with .get-basename()
). These names are byte strings that are used to identify the file on the filesystem (relative to its parent directory) and there is no guarantees that they have any particular charset encoding or even make any sense at all. 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 .query-info()
. This is guaranteed to be in UTF-8 and can be used in a user interface. But always store the real basename or the Gnome::Gio::R-File to use to actually access the file, because there is no way to go from a display name to the actual name.
Using Gnome::Gio::R-File as an identifier has the same weaknesses as using a path in that there may be multiple aliases for the same file. For instance, hard or soft links may cause two different GFiles to refer to the same file. Other possible causes for aliases are: case insensitive filesystems, short and long names on FAT/NTFS, or bind mounts in Linux. If you want to check if two GFiles point to the same file you can query for the G_FILE_ATTRIBUTE_ID_FILE
attribute. Note that Gnome::Gio::R-File does some trivial canonicalization of pathnames passed in, so that trivial differences in the path string used at creation (duplicated slashes, slash at end of path, "." or ".." path segments, etc) does not create different GFiles.
Many Gnome::Gio::R-File operations have both synchronous and asynchronous versions to suit your application. Asynchronous versions of synchronous functions simply have _async() appended to their function names. The asynchronous I/O functions call a Gnome::Gio::T-iotypes which is then used to finalize the operation, producing a GAsyncResult which is then passed to the function's matching _finish() operation.
It is highly recommended to use asynchronous calls when running within a shared main loop, such as in the main thread of an application. This avoids I/O operations blocking other sources on the main loop from being dispatched. Synchronous I/O operations should be performed from worker threads. See the introduction to asynchronous programming section for more.
Some Gnome::Gio::R-File operations almost always take a noticeable amount of time, and so do not have synchronous analogs. Notable cases include:
.mount-mountable()
to mount a mountable file..unmount-mountable-with-operation()
to unmount a mountable file..eject-mountable-with-operation()
to eject a mountable file.
Entity Tags # {#gfile-etag}
One notable feature of GFiles are entity tags, or "etags" for short. Entity tags are somewhat like a more abstract version of the traditional mtime, and can be used to quickly determine if the file has been modified from the version on the file system. See the HTTP 1.1 [specification](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html) for HTTP Etag headers, which are a very similar concept.
Uml Diagram

Class initialization
new
:native-object
Create an object using a native object from an object of the same type found elsewhere. See also Gnome::N::TopLevelSupportClass.
multi method new ( N-Object() :$native-object! )
new-build-filename This function is not yet available
Constructs a Gnome::Gio::R-File from a series of elements using the correct separator for filenames.
Using this function is equivalent to calling g_build_filename(), followed by .new-for-path()
on the result.
method new-build-filename ( Str $first-element, … --> Gnome::Gio::File \)
$first-element; the first element in the path.
…; …. Note that each argument must be specified as a type followed by its value!
new-for-commandline-arg
Creates a Gnome::Gio::R-File with the given argument from the command line. The value of $arg
can be either a URI, an absolute path or a relative path resolved relative to the current working directory. This operation never fails, but the returned object might not support any I/O operation if $arg
points to a malformed path.
Note that on Windows, this function expects its argument to be in UTF-8 -- not the system code page. This means that you should not use this function with string from argv as it is passed to main(). g_win32_get_command_line() will return a UTF-8 version of the commandline. Gnome::Gio::Application also uses UTF-8 but g_application_command_line_create_file_for_arg() may be more useful for you there. It is also always possible to use this function with GOptionContext arguments of type G_OPTION_ARG_FILENAME
.
method new-for-commandline-arg ( Str $arg --> Gnome::Gio::File \)
$arg; a command line string.
new-for-commandline-arg-and-cwd
Creates a Gnome::Gio::R-File with the given argument from the command line.
This function is similar to .new-for-commandline-arg()
except that it allows for passing the current working directory as an argument instead of using the current working directory of the process.
This is useful if the commandline argument was given in a context other than the invocation of the current process.
See also g_application_command_line_create_file_for_arg().
method new-for-commandline-arg-and-cwd ( Str $arg, Str $cwd --> Gnome::Gio::File \)
$arg; a command line string.
$cwd; the current working directory of the commandline.
new-for-path
Constructs a Gnome::Gio::R-File for a given path. This operation never fails, but the returned object might not support any I/O operation if $path
is malformed.
method new-for-path ( Str $path --> Gnome::Gio::File \)
$path; a string containing a relative or absolute path. The string must be encoded in the glib filename encoding..
new-for-uri
Constructs a Gnome::Gio::R-File for a given URI. This operation never fails, but the returned object might not support any I/O operation if $uri
is malformed or if the uri type is not supported.
method new-for-uri ( Str $uri --> Gnome::Gio::File \)
$uri; a UTF-8 string containing a URI.
new-tmp
Opens a file in the preferred directory for temporary files (as returned by g_get_tmp_dir()) and returns a Gnome::Gio::R-File and Gnome::Gio::FileIOStream pointing to it. $tmpl
should be a string in the GLib file name encoding containing a sequence of six 'X' characters, and containing no directory components. If it is undefined, a default template is used.
Unlike the other Gnome::Gio::R-File constructors, this will return undefined if a temporary file could not be created.
method new-tmp ( Str $tmpl, N-Object() $iostream, CArray[N-Error] $err --> Gnome::Gio::File \)
$tmpl; Template for the file name, as in
.open-tmp()
, or undefined for a default template.$iostream; (transfer ownership: full) on return, a Gnome::Gio::FileIOStream for the created file.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
parse-name
Constructs a Gnome::Gio::R-File with the given $parse-name
(i.e. something given by .get-parse-name()
). This operation never fails, but the returned object might not support any I/O operation if the $parse-name
cannot be parsed.
method parse-name ( Str $parse-name --> Gnome::Gio::File \)
$parse-name; a file name or path to be parsed.
Methods
append-to
Gets an output stream for appending data to the file. If the file doesn't already exist it is created.
By default files created are generally readable by everyone, but if you pass G_FILE_CREATE_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 defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
Some file systems don't allow all file names, and may return an G_IO_ERROR_INVALID_FILENAME
error. If the file is a directory the G_IO_ERROR_IS_DIRECTORY
error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
method append-to ( UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$flags; a set of Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::FileOutputStream, or undefined on error. Free the returned object with g_object_unref()..
append-to-async
Asynchronously opens $file
for appending.
For more details, see .append-to()
which is the synchronous version of this call.
When the operation is finished, $callback
will be called. You can then call .append-to-finish()
to get the result of the operation.
method append-to-async ( UInt $flags, Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$flags; a set of Gnome::Gio::T-ioenums.
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
append-to-finish
Finishes an asynchronous file append operation started with .append-to-async()
.
method append-to-finish ( N-Object() $res, CArray[N-Error] $err --> N-Object )
$res; Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a valid Gnome::Gio::FileOutputStream or undefined on error. Free the returned object with g_object_unref()..
build-attribute-list-for-copy
Prepares the file attribute query string for copying to $file
.
This function prepares an attribute query string to be passed to .query-info()
to get a list of attributes normally copied with the file (see .copy-attributes()
for the detailed description). This function is used by the implementation of .copy-attributes()
and is useful when one needs to query and set the attributes in two stages (e.g., for recursive move of a directory).
method build-attribute-list-for-copy ( UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> Str )
$flags; a set of Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; an attribute query string for .query-info()
, or undefined if an error occurs..
copy
Copies the file $source
to the location specified by $destination
. Can not handle recursive copies of directories.
If the flag G_FILE_COPY_OVERWRITE
is specified an already existing $destination
file is overwritten.
If the flag G_FILE_COPY_NOFOLLOW_SYMLINKS
is specified then symlinks will be copied as symlinks, otherwise the target of the $source
symlink will be copied.
If the flag G_FILE_COPY_ALL_METADATA
is specified then all the metadata that is possible to copy is copied, not just the default subset (which, for instance, does not include the owner, see Gnome::Gio::FileInfo).
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
If $progress-callback
is defined, then the operation can be monitored by setting this to a Gnome::Gio::T-iotypes function. $progress-callback-data
will be passed to this function. It is guaranteed that this callback will be called after all data has been transferred with the total number of bytes copied during the operation.
If the $source
file does not exist, then the G_IO_ERROR_NOT_FOUND
error is returned, independent on the status of the $destination
.
If G_FILE_COPY_OVERWRITE
is not specified and the target exists, then the error G_IO_ERROR_EXISTS
is returned.
If trying to overwrite a file over a directory, the G_IO_ERROR_IS_DIRECTORY
error is returned. If trying to overwrite a directory with a directory the G_IO_ERROR_WOULD_MERGE
error is returned.
If the source is a directory and the target does not exist, or G_FILE_COPY_OVERWRITE
is specified and the target is a file, then the G_IO_ERROR_WOULD_RECURSE
error is returned.
If you are interested in copying the Gnome::Gio::R-File object itself (not the on-disk file), see .dup()
.
method copy ( N-Object() $destination, UInt $flags, N-Object() $cancellable, GFileProgressCallback &progress-callback, gpointer $progress-callback-data, CArray[N-Error] $err --> Bool )
$destination; destination Gnome::Gio::R-File.
$flags; set of Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GFileProgressCallback &progress-callback; function to callback with progress information, or undefined if progress information is not needed. The function must be specified with the following signature;
:( $current-num-bytes, $total-num-bytes, gpointer $data )
.$progress-callback-data; user data to pass to
$progress-callback
.$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
on success, False
otherwise..
copy-async
Copies the file $source
to the location specified by $destination
asynchronously. For details of the behaviour, see .copy()
.
If $progress-callback
is defined, then that function that will be called just like in .copy()
. The callback will run in the default main context of the thread calling .copy-async()
— the same context as $callback
is run in.
When the operation is finished, $callback
will be called. You can then call .copy-finish()
to get the result of the operation.
method copy-async ( N-Object() $destination, UInt $flags, Int() $io-priority, N-Object() $cancellable, GFileProgressCallback &progress-callback, gpointer $progress-callback-data, GAsyncReadyCallback &callback, gpointer $user-data )
$destination; destination Gnome::Gio::R-File.
$flags; set of Gnome::Gio::T-ioenums.
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GFileProgressCallback &progress-callback; function to callback with progress information, or undefined if progress information is not needed. The function must be specified with the following signature;
:( $current-num-bytes, $total-num-bytes, gpointer $data )
.$progress-callback-data; user data to pass to
$progress-callback
.GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
copy-attributes
Copies the file attributes from $source
to $destination
.
Normally only a subset of the file attributes are copied, those that are copies in a normal file copy operation (which for instance does not include e.g. owner). However if G_FILE_COPY_ALL_METADATA
is specified in $flags
, then all the metadata that is possible to copy is copied. This is useful when implementing move by copy + delete source.
method copy-attributes ( N-Object() $destination, UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> Bool )
$destination; a Gnome::Gio::R-File to copy attributes to.
$flags; a set of Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the attributes were copied successfully, False
otherwise..
copy-finish
Finishes copying the file started with .copy-async()
.
method copy-finish ( N-Object() $res, CArray[N-Error] $err --> Bool )
$res; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a True
on success, False
on error..
create
Creates a new file and returns an output stream for writing to it. The file must not already exist.
By default files created are generally readable by everyone, but if you pass G_FILE_CREATE_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 defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
If a file or directory with this name already exists the G_IO_ERROR_EXISTS
error will be returned. Some file systems don't allow all file names, and may return an G_IO_ERROR_INVALID_FILENAME
error, and if the name is to long G_IO_ERROR_FILENAME_TOO_LONG
will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
method create ( UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$flags; a set of Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::FileOutputStream for the newly created file, or undefined on error. Free the returned object with g_object_unref()..
create-async
Asynchronously creates a new file and returns an output stream for writing to it. The file must not already exist.
For more details, see .create()
which is the synchronous version of this call.
When the operation is finished, $callback
will be called. You can then call .create-finish()
to get the result of the operation.
method create-async ( UInt $flags, Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$flags; a set of Gnome::Gio::T-ioenums.
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
create-finish
Finishes an asynchronous file create operation started with .create-async()
.
method create-finish ( N-Object() $res, CArray[N-Error] $err --> N-Object )
$res; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::FileOutputStream or undefined on error. Free the returned object with g_object_unref()..
create-readwrite
Creates a new file and returns a stream for reading and writing to it. The file must not already exist.
By default files created are generally readable by everyone, but if you pass G_FILE_CREATE_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 defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
If a file or directory with this name already exists, the G_IO_ERROR_EXISTS
error will be returned. Some file systems don't allow all file names, and may return an G_IO_ERROR_INVALID_FILENAME
error, and if the name is too long, G_IO_ERROR_FILENAME_TOO_LONG
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.
method create-readwrite ( UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$flags; a set of Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::FileIOStream for the newly created file, or undefined on error. Free the returned object with g_object_unref()..
create-readwrite-async
Asynchronously creates a new file and returns a stream for reading and writing to it. The file must not already exist.
For more details, see .create-readwrite()
which is the synchronous version of this call.
When the operation is finished, $callback
will be called. You can then call .create-readwrite-finish()
to get the result of the operation.
method create-readwrite-async ( UInt $flags, Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$flags; a set of Gnome::Gio::T-ioenums.
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
create-readwrite-finish
Finishes an asynchronous file create operation started with .create-readwrite-async()
.
method create-readwrite-finish ( N-Object() $res, CArray[N-Error] $err --> N-Object )
$res; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::FileIOStream or undefined on error. Free the returned object with g_object_unref()..
delete
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, G_IO_ERROR_NOT_FOUND
will be returned. This allows for deletion to be implemented avoiding [time-of-check to time-of-use races](https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use):
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method delete ( N-Object() $cancellable, CArray[N-Error] $err --> Bool )
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the file was deleted. False
otherwise..
delete-async
Asynchronously delete 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().
method delete-async ( Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
delete-finish
Finishes deleting a file started with .delete-async()
.
method delete-finish ( N-Object() $result, CArray[N-Error] $err --> Bool )
$result; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the file was deleted. False
otherwise..
dup
Duplicates a Gnome::Gio::R-File handle. This operation does not duplicate the actual file or directory represented by the Gnome::Gio::R-File; see .copy()
if attempting to copy a file.
.dup()
is useful when a second handle is needed to the same underlying file, for use in a separate thread (Gnome::Gio::R-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.
method dup (--> N-Object )
Return value; a new Gnome::Gio::R-File that is a duplicate of the given Gnome::Gio::R-File..
eject-mountable
Note: The native version of this routine is deprecated in gio-lib() since version 2.22
Starts an asynchronous eject on a mountable. When this operation has completed, $callback
will be called with $user-user
data, and the operation can be finalized with .eject-mountable-finish()
.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method eject-mountable ( UInt $flags, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$flags; flags affecting the operation.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied, or undefined. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
eject-mountable-finish
Note: The native version of this routine is deprecated in gio-lib() since version 2.22
Finishes an asynchronous eject operation started by .eject-mountable()
.
method eject-mountable-finish ( N-Object() $result, CArray[N-Error] $err --> Bool )
$result; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the $file
was ejected successfully. False
otherwise..
eject-mountable-with-operation
Starts an asynchronous eject on a mountable. When this operation has completed, $callback
will be called with $user-user
data, and the operation can be finalized with .eject-mountable-with-operation-finish()
.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method eject-mountable-with-operation ( UInt $flags, N-Object() $mount-operation, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$flags; flags affecting the operation.
$mount-operation; a Gnome::Gio::MountOperation, or undefined to avoid user interaction.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied, or undefined. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
eject-mountable-with-operation-finish
Finishes an asynchronous eject operation started by .eject-mountable-with-operation()
.
method eject-mountable-with-operation-finish ( N-Object() $result, CArray[N-Error] $err --> Bool )
$result; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the $file
was ejected successfully. False
otherwise..
enumerate-children
Gets the requested information about the files in a directory. The result is a Gnome::Gio::FileEnumerator object that will give out Gnome::Gio::FileInfo objects for all the files in the directory.
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. $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 be "standard::*,owner::user". The standard attributes are available as defines, like G_FILE_ATTRIBUTE_STANDARD_NAME
. G_FILE_ATTRIBUTE_STANDARD_NAME
should always be specified if you plan to call .enumerator-get-child()
or .enumerator-iterate()
on the returned enumerator.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
If the file does not exist, the G_IO_ERROR_NOT_FOUND
error will be returned. If the file is not a directory, the G_IO_ERROR_NOT_DIRECTORY
error will be returned. Other errors are possible too.
method enumerate-children ( Str $attributes, UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$attributes; an attribute query string.
$flags; a set of Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; A Gnome::Gio::FileEnumerator if successful, undefined on error. Free the returned object with g_object_unref()..
enumerate-children-async
Asynchronously gets the requested information about the files in a directory. The result is a Gnome::Gio::FileEnumerator object that will give out Gnome::Gio::FileInfo objects for all the files in the directory.
For more details, see .enumerate-children()
which is the synchronous version of this call.
When the operation is finished, $callback
will be called. You can then call .enumerate-children-finish()
to get the result of the operation.
method enumerate-children-async ( Str $attributes, UInt $flags, Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$attributes; an attribute query string.
$flags; a set of Gnome::Gio::T-ioenums.
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
enumerate-children-finish
Finishes an async enumerate children operation. See .enumerate-children-async()
.
method enumerate-children-finish ( N-Object() $res, CArray[N-Error] $err --> N-Object )
$res; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::FileEnumerator or undefined if an error occurred. Free the returned object with g_object_unref()..
equal
Checks if the two given GFiles refer to the same file.
Note that two GFiles that differ can still refer to the same file on the filesystem due to various forms of filename aliasing.
This call does no blocking I/O.
method equal ( N-Object() $file2 --> Bool )
$file2; the second Gnome::Gio::R-File.
Return value; True
if $file1
and $file2
are equal..
find-enclosing-mount
Gets a Gnome::Gio::R-Mount for the Gnome::Gio::R-File.
Gnome::Gio::R-Mount is returned only for user interesting locations, see Gnome::Gio::VolumeMonitor. If the GFileIface for $file
does not have a #mount, $error
will be set to G_IO_ERROR_NOT_FOUND
and undefined #will be returned.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method find-enclosing-mount ( N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::R-Mount where the $file
is located or undefined on error. Free the returned object with g_object_unref()..
find-enclosing-mount-async
Asynchronously gets the mount for the file.
For more details, see .find-enclosing-mount()
which is the synchronous version of this call.
When the operation is finished, $callback
will be called. You can then call .find-enclosing-mount-finish()
to get the result of the operation.
method find-enclosing-mount-async ( Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
find-enclosing-mount-finish
Finishes an asynchronous find mount request. See .find-enclosing-mount-async()
.
method find-enclosing-mount-finish ( N-Object() $res, CArray[N-Error] $err --> N-Object )
$res; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; Gnome::Gio::R-Mount for given $file
or undefined on error. Free the returned object with g_object_unref()..
get-basename
Gets the base name (the last component of the path) for a given Gnome::Gio::R-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 .query-info()
.
This call does no blocking I/O.
method get-basename (--> Str )
Return value; string containing the Gnome::Gio::R-File's base name, or undefined if given Gnome::Gio::R-File is invalid. The returned string should be freed with g_free() when no longer needed..
get-child
Gets a child of $file
with basename equal to $name
.
Note that the file with that specific name might not exist, but you can still have a Gnome::Gio::R-File that points to it. You can use this for instance to create that file.
This call does no blocking I/O.
method get-child ( Str $name --> N-Object )
$name; string containing the child's basename.
Return value; a Gnome::Gio::R-File to a child specified by $name
. Free the returned object with g_object_unref()..
get-child-for-display-name
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 undefined and $error
will be set. This is very useful when constructing a Gnome::Gio::R-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.
method get-child-for-display-name ( Str $display-name, CArray[N-Error] $err --> N-Object )
$display-name; string to a possible child.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::R-File to the specified child, or undefined if the display name couldn't be converted. Free the returned object with g_object_unref()..
get-parent
Gets the parent directory for the $file
. If the $file
represents the root directory of the file system, then undefined will be returned.
This call does no blocking I/O.
method get-parent (--> N-Object )
Return value; a Gnome::Gio::R-File structure to the parent of the given Gnome::Gio::R-File or undefined if there is no parent. Free the returned object with g_object_unref()..
get-parse-name
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 Gnome::Gio::R-File back using .parse-name()
.
This is generally used to show the Gnome::Gio::R-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.
method get-parse-name (--> Str )
Return value; a string containing the Gnome::Gio::R-File's parse name. The returned string should be freed with g_free() when no longer needed..
get-path
Gets the local pathname for Gnome::Gio::R-File, if one exists. If non-undefined, this is guaranteed to be an absolute, canonical path. It might contain symlinks.
This call does no blocking I/O.
method get-path (--> Str )
Return value; string containing the Gnome::Gio::R-File's path, or undefined if no such path exists. The returned string should be freed with g_free() when no longer needed..
get-relative-path
Gets the path for $descendant
relative to $parent
.
This call does no blocking I/O.
method get-relative-path ( N-Object() $descendant --> Str )
$descendant; input Gnome::Gio::R-File.
Return value; string with the relative path from $descendant
to $parent
, or undefined if $descendant
doesn't have $parent
as prefix. The returned string should be freed with g_free() when no longer needed..
get-uri
Gets the URI for the $file
.
This call does no blocking I/O.
method get-uri (--> Str )
Return value; a string containing the Gnome::Gio::R-File's URI. If the Gnome::Gio::R-File was constructed with an invalid URI, an invalid URI is returned. The returned string should be freed with g_free() when no longer needed..
get-uri-scheme
Gets the URI scheme for a Gnome::Gio::R-File. RFC 3986 decodes the scheme as:
Common schemes include "file", "http", "ftp", etc.
The scheme can be different from the one used to construct the Gnome::Gio::R-File, in that it might be replaced with one that is logically equivalent to the Gnome::Gio::R-File.
This call does no blocking I/O.
method get-uri-scheme (--> Str )
Return value; a string containing the URI scheme for the given Gnome::Gio::R-File or undefined if the Gnome::Gio::R-File was constructed with an invalid URI. The returned string should be freed with g_free() when no longer needed..
has-parent
Checks if $file
has a parent, and optionally, if it is $parent
.
If $parent
is undefined then this function returns True
if $file
has any parent at all. If $parent
is non-undefined then True
is only returned if $file
is an immediate child of $parent
.
method has-parent ( N-Object() $parent --> Bool )
$parent; the parent to check for, or undefined.
Return value; True
if $file
is an immediate child of $parent
(or any parent in the case that $parent
is undefined)..
has-prefix
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 Gnome::Gio::R-File is not a prefix of itself. If you want to check for equality, use .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
.
method has-prefix ( N-Object() $prefix --> Bool )
$prefix; input Gnome::Gio::R-File.
Return value; True
if the $file
's parent, grandparent, etc is $prefix
, False
otherwise..
has-uri-scheme
Checks to see if a Gnome::Gio::R-File has a given URI scheme.
This call does no blocking I/O.
method has-uri-scheme ( Str $uri-scheme --> Bool )
$uri-scheme; a string containing a URI scheme.
Return value; True
if Gnome::Gio::R-File's backend supports the given URI scheme, False
if URI scheme is undefined, not supported, or Gnome::Gio::R-File is invalid..
hash
Creates a hash value for a Gnome::Gio::R-File.
This call does no blocking I/O.
method hash (--> UInt )
Return value; 0 if $file
is not a valid Gnome::Gio::R-File, otherwise an integer that can be used as hash value for the Gnome::Gio::R-File. This function is intended for easily hashing a Gnome::Gio::R-File to add to a Gnome::Glib::N-HashTable or similar data structure..
is-native
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 .get-path()
will still return a native path.
This call does no blocking I/O.
method is-native (--> Bool )
Return value; True
if $file
is native.
load-bytes
Loads the contents of $file
and returns it as Gnome::Glib::N-Bytes.
If $file
is a resource:// based URI, the resulting bytes will reference the embedded resource instead of a copy. Otherwise, this is equivalent to calling .load-contents()
and g_bytes_new_take().
For resources, $etag-out
will be set to undefined.
The data contained in the resulting Gnome::Glib::N-Bytes is always zero-terminated, but this is not included in the Gnome::Glib::N-Bytes length. The resulting Gnome::Glib::N-Bytes should be freed with g_bytes_unref() when no longer in use.
method load-bytes ( N-Object() $cancellable, Array[Str] $etag-out, CArray[N-Error] $err --> N-Object )
$cancellable; a Gnome::Gio::Cancellable or undefined.
$etag-out; (transfer ownership: full) a location to place the current entity tag for the file, or undefined if the entity tag is not needed.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Glib::N-Bytes or undefined and $error
is set.
load-bytes-async
Asynchronously loads the contents of $file
as Gnome::Glib::N-Bytes.
If $file
is a resource:// based URI, the resulting bytes will reference the embedded resource instead of a copy. Otherwise, this is equivalent to calling .load-contents-async()
and g_bytes_new_take(). $callback
should call .load-bytes-finish()
to get the result of this asynchronous operation.
See .load-bytes()
for more information.
method load-bytes-async ( N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$cancellable; a Gnome::Gio::Cancellable or undefined.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
load-bytes-finish
Completes an asynchronous request to .load-bytes-async()
.
For resources, $etag-out
will be set to undefined.
The data contained in the resulting Gnome::Glib::N-Bytes is always zero-terminated, but this is not included in the Gnome::Glib::N-Bytes length. The resulting Gnome::Glib::N-Bytes should be freed with g_bytes_unref() when no longer in use.
See .load-bytes()
for more information.
method load-bytes-finish ( N-Object() $result, Array[Str] $etag-out, CArray[N-Error] $err --> N-Object )
$result; a Gnome::Gio::R-AsyncResult provided to the callback.
$etag-out; (transfer ownership: full) a location to place the current entity tag for the file, or undefined if the entity tag is not needed.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Glib::N-Bytes or undefined and $error
is set.
load-contents
Loads the content of the file into memory. The data is always zero-terminated, but this is not included in the resultant $length
. The returned $contents
should be freed with g_free() when no longer needed.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method load-contents ( N-Object() $cancellable, Array[Str] $contents, Array[gsize] $length, Array[Str] $etag-out, CArray[N-Error] $err --> Bool )
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$contents; (transfer ownership: full) a location to place the contents of the file.
$length; (transfer ownership: full) a location to place the length of the contents of the file, or undefined if the length is not needed.
$etag-out; (transfer ownership: full) a location to place the current entity tag for the file, or undefined if the entity tag is not needed.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the $file
's contents were successfully loaded. False
if there were errors..
load-contents-async
Starts an asynchronous load of the $file
's contents.
For more details, see .load-contents()
which is the synchronous version of this call.
When the load operation has completed, $callback
will be called with $user
data. To finish the operation, call .load-contents-finish()
with the Gnome::Gio::R-AsyncResult returned by the $callback
.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method load-contents-async ( N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
load-contents-finish
Finishes an asynchronous load of the $file
's contents. The contents are placed in $contents
, and $length
is set to the size of the $contents
string. The $contents
should be freed with g_free() when no longer needed. If $etag-out
is present, it will be set to the new entity tag for the $file
.
method load-contents-finish ( N-Object() $res, Array[Str] $contents, Array[gsize] $length, Array[Str] $etag-out, CArray[N-Error] $err --> Bool )
$res; a Gnome::Gio::R-AsyncResult.
$contents; (transfer ownership: full) a location to place the contents of the file.
$length; (transfer ownership: full) a location to place the length of the contents of the file, or undefined if the length is not needed.
$etag-out; (transfer ownership: full) a location to place the current entity tag for the file, or undefined if the entity tag is not needed.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the load was successful. If False
and $error
is present, it will be set appropriately..
load-partial-contents-async
Reads the partial contents of a file. A Gnome::Gio::T-iotypes should be used to stop reading from the file when appropriate, else this function will behave exactly as .load-contents-async()
. This operation can be finished by .load-partial-contents-finish()
.
Users of this function should be aware that $user-data
is passed to both the $read-more-callback
and the $callback
.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method load-partial-contents-async ( N-Object() $cancellable, GFileReadMoreCallback &read-more-callback, GAsyncReadyCallback &callback, gpointer $user-data )
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GFileReadMoreCallback &read-more-callback; a Gnome::Gio::T-iotypes to receive partial data and to specify whether further data should be read. The function must be specified with the following signature;
:( Str $file-contents, $file-size, gpointer $callback-data )
.GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to the callback functions.
load-partial-contents-finish
Finishes an asynchronous partial load operation that was started with .load-partial-contents-async()
. The data is always zero-terminated, but this is not included in the resultant $length
. The returned $contents
should be freed with g_free() when no longer needed.
method load-partial-contents-finish ( N-Object() $res, Array[Str] $contents, Array[gsize] $length, Array[Str] $etag-out, CArray[N-Error] $err --> Bool )
$res; a Gnome::Gio::R-AsyncResult.
$contents; (transfer ownership: full) a location to place the contents of the file.
$length; (transfer ownership: full) a location to place the length of the contents of the file, or undefined if the length is not needed.
$etag-out; (transfer ownership: full) a location to place the current entity tag for the file, or undefined if the entity tag is not needed.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the load was successful. If False
and $error
is present, it will be set appropriately..
make-directory
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 Gnome::Gio::R-File. To recursively create directories, see .make-directory-with-parents()
. This function will fail if the parent directory does not exist, setting $error
to G_IO_ERROR_NOT_FOUND
. If the file system doesn't support creating directories, this function will fail, setting $error
to G_IO_ERROR_NOT_SUPPORTED
.
For a local Gnome::Gio::R-File the newly created directory will have the default (current) ownership and permissions of the current process.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method make-directory ( N-Object() $cancellable, CArray[N-Error] $err --> Bool )
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
on successful creation, False
otherwise..
make-directory-async
Asynchronously creates a directory.
method make-directory-async ( Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
make-directory-finish
Finishes an asynchronous directory creation, started with .make-directory-async()
.
method make-directory-finish ( N-Object() $result, CArray[N-Error] $err --> Bool )
$result; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
on successful directory creation, False
otherwise..
make-directory-with-parents
Creates a directory and any parent directories that may not exist similar to 'mkdir -p'. If the file system does not support creating directories, this function will fail, setting $error
to G_IO_ERROR_NOT_SUPPORTED
. If the directory itself already exists, this function will fail setting $error
to G_IO_ERROR_EXISTS
, unlike the similar g_mkdir_with_parents().
For a local Gnome::Gio::R-File the newly created directories will have the default (current) ownership and permissions of the current process.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method make-directory-with-parents ( N-Object() $cancellable, CArray[N-Error] $err --> Bool )
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if all directories have been successfully created, False
otherwise..
make-symbolic-link
Creates a symbolic link named $file
which contains the string $symlink-value
.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method make-symbolic-link ( Str $symlink-value, N-Object() $cancellable, CArray[N-Error] $err --> Bool )
$symlink-value; a string with the path for the target of the new symlink.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
on the creation of a new symlink, False
otherwise..
measure-disk-usage
Recursively measures the disk usage of $file
.
This is essentially an analog of the 'du' command, but it also reports the number of directories and non-directory files encountered (including things like symbolic links).
By default, errors are only reported against the toplevel file itself. Errors found while recursing are silently ignored, unless G_FILE_MEASURE_REPORT_ANY_ERROR
is given in $flags
.
The returned size, $disk-usage
, is in bytes and should be formatted with g_format_size() in order to get something reasonable for showing in a user interface. $progress-callback
and $progress-data
can be given to request periodic progress updates while scanning. See the documentation for Gnome::Gio::T-iotypes for information about when and how the callback will be invoked.
method measure-disk-usage ( UInt $flags, N-Object() $cancellable, GFileMeasureProgressCallback &progress-callback, gpointer $progress-data, Array[Int] $disk-usage, Array[Int] $num-dirs, Array[Int] $num-files, CArray[N-Error] $err --> Bool )
$flags; Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable.
GFileMeasureProgressCallback &progress-callback; a Gnome::Gio::T-iotypes. The function must be specified with the following signature;
:( gboolean $reporting, guint64 $current-size, guint64 $num-dirs, guint64 $num-files, gpointer $data )
.$progress-data; user_data for
$progress-callback
.$disk-usage; (transfer ownership: full) the number of bytes of disk space used.
$num-dirs; (transfer ownership: full) the number of directories encountered.
$num-files; (transfer ownership: full) the number of non-directories encountered.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if successful, with the out parameters set. False
otherwise, with $error
set..
measure-disk-usage-async
Recursively measures the disk usage of $file
.
This is the asynchronous version of .measure-disk-usage()
. See there for more information.
method measure-disk-usage-async ( UInt $flags, Int() $io-priority, N-Object() $cancellable, GFileMeasureProgressCallback &progress-callback, gpointer $progress-data, GAsyncReadyCallback &callback, gpointer $user-data )
$flags; Gnome::Gio::T-ioenums.
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable.
GFileMeasureProgressCallback &progress-callback; a Gnome::Gio::T-iotypes. The function must be specified with the following signature;
:( gboolean $reporting, guint64 $current-size, guint64 $num-dirs, guint64 $num-files, gpointer $data )
.$progress-data; user_data for
$progress-callback
.GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when complete. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
measure-disk-usage-finish
Collects the results from an earlier call to .measure-disk-usage-async()
. See .measure-disk-usage()
for more information.
method measure-disk-usage-finish ( N-Object() $result, Array[Int] $disk-usage, Array[Int] $num-dirs, Array[Int] $num-files, CArray[N-Error] $err --> Bool )
$result; the Gnome::Gio::R-AsyncResult passed to your Gnome::Gio::T-iotypes.
$disk-usage; (transfer ownership: full) the number of bytes of disk space used.
$num-dirs; (transfer ownership: full) the number of directories encountered.
$num-files; (transfer ownership: full) the number of non-directories encountered.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if successful, with the out parameters set. False
otherwise, with $error
set..
monitor
Obtains a file or directory monitor for the given file, depending on the type of the file.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method monitor ( UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$flags; a set of Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::FileMonitor for the given $file
, or undefined on error. Free the returned object with g_object_unref()..
monitor-directory
Obtains a directory monitor for the given file. This may fail if directory monitoring is not supported.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
It does not make sense for $flags
to contain G_FILE_MONITOR_WATCH_HARD_LINKS
, since hard links can not be made to directories. It is not possible to monitor all the files in a directory for changes made via hard links; if you want to do this then you must register individual watches with .monitor()
.
method monitor-directory ( UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$flags; a set of Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::FileMonitor for the given $file
, or undefined on error. Free the returned object with g_object_unref()..
monitor-file
Obtains a file monitor for the given file. If no file notification mechanism exists, then regular polling of the file is used.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
If $flags
contains G_FILE_MONITOR_WATCH_HARD_LINKS
then the monitor will also attempt to report changes made to the file via another filename (ie, a hard link). Without this flag, you can only rely on changes made through the filename contained in $file
to be reported. Using this flag may result in an increase in resource usage, and may not have any effect depending on the Gnome::Gio::FileMonitor backend and/or filesystem type.
method monitor-file ( UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$flags; a set of Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::FileMonitor for the given $file
, or undefined on error. Free the returned object with g_object_unref()..
mount-enclosing-volume
Starts a $mount-operation
, mounting the volume that contains the file $location
.
When this operation has completed, $callback
will be called with $user-user
data, and the operation can be finalized with .mount-enclosing-volume-finish()
.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method mount-enclosing-volume ( UInt $flags, N-Object() $mount-operation, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$flags; flags affecting the operation.
$mount-operation; a Gnome::Gio::MountOperation or undefined to avoid user interaction.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied, or undefined. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
mount-enclosing-volume-finish
Finishes a mount operation started by .mount-enclosing-volume()
.
method mount-enclosing-volume-finish ( N-Object() $result, CArray[N-Error] $err --> Bool )
$result; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if successful. If an error has occurred, this function will return False
and set $error
appropriately if present..
mount-mountable
Mounts a file of type G_FILE_TYPE_MOUNTABLE. Using $mount-operation
, you can request callbacks when, for instance, passwords are needed during authentication.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
When the operation is finished, $callback
will be called. You can then call .mount-mountable-finish()
to get the result of the operation.
method mount-mountable ( UInt $flags, N-Object() $mount-operation, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$flags; flags affecting the operation.
$mount-operation; a Gnome::Gio::MountOperation, or undefined to avoid user interaction.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied, or undefined. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
mount-mountable-finish
Finishes a mount operation. See .mount-mountable()
for details.
Finish an asynchronous mount operation that was started with .mount-mountable()
.
method mount-mountable-finish ( N-Object() $result, CArray[N-Error] $err --> N-Object )
$result; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::R-File or undefined on error. Free the returned object with g_object_unref()..
move
Tries to move the file or directory $source
to the location specified by $destination
. If native move operations are supported then this is used, otherwise a copy + delete fallback is used. The native implementation may support moving directories (for instance on moves inside the same filesystem), but the fallback code does not.
If the flag G_FILE_COPY_OVERWRITE
is specified an already existing $destination
file is overwritten.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
If $progress-callback
is defined, then the operation can be monitored by setting this to a Gnome::Gio::T-iotypes function. $progress-callback-data
will be passed to this function. It is guaranteed that this callback will be called after all data has been transferred with the total number of bytes copied during the operation.
If the $source
file does not exist, then the G_IO_ERROR_NOT_FOUND
error is returned, independent on the status of the $destination
.
If G_FILE_COPY_OVERWRITE
is not specified and the target exists, then the error G_IO_ERROR_EXISTS
is returned.
If trying to overwrite a file over a directory, the G_IO_ERROR_IS_DIRECTORY
error is returned. If trying to overwrite a directory with a directory the G_IO_ERROR_WOULD_MERGE
error is returned.
If the source is a directory and the target does not exist, or G_FILE_COPY_OVERWRITE
is specified and the target is a file, then the G_IO_ERROR_WOULD_RECURSE
error may be returned (if the native move operation isn't available).
method move ( N-Object() $destination, UInt $flags, N-Object() $cancellable, GFileProgressCallback &progress-callback, gpointer $progress-callback-data, CArray[N-Error] $err --> Bool )
$destination; Gnome::Gio::R-File pointing to the destination location.
$flags; set of Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GFileProgressCallback &progress-callback; Gnome::Gio::T-iotypes function for updates. The function must be specified with the following signature;
:( $current-num-bytes, $total-num-bytes, gpointer $data )
.$progress-callback-data; gpointer to user data for the callback function.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
on successful move, False
otherwise..
move-async
Asynchronously moves a file $source
to the location of $destination
. For details of the behaviour, see .move()
.
If $progress-callback
is defined, then that function that will be called just like in .move()
. The callback will run in the default main context of the thread calling .move-async()
— the same context as $callback
is run in.
When the operation is finished, $callback
will be called. You can then call .move-finish()
to get the result of the operation.
method move-async ( N-Object() $destination, UInt $flags, Int() $io-priority, N-Object() $cancellable, GFileProgressCallback &progress-callback, gpointer $progress-callback-data, GAsyncReadyCallback &callback, gpointer $user-data )
$destination; Gnome::Gio::R-File pointing to the destination location.
$flags; set of Gnome::Gio::T-ioenums.
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GFileProgressCallback &progress-callback; Gnome::Gio::T-iotypes function for updates. The function must be specified with the following signature;
:( $current-num-bytes, $total-num-bytes, gpointer $data )
.$progress-callback-data; gpointer to user data for the callback function.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
move-finish
Finishes an asynchronous file movement, started with .move-async()
.
method move-finish ( N-Object() $result, CArray[N-Error] $err --> Bool )
$result; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
on successful file move, False
otherwise..
open-readwrite
Opens an existing file for reading and writing. The result is a Gnome::Gio::FileIOStream that can be used to read and write the contents of the file.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
If the file does not exist, the G_IO_ERROR_NOT_FOUND
error will be returned. If the file is a directory, the G_IO_ERROR_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.
method open-readwrite ( N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$cancellable; a Gnome::Gio::Cancellable.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; Gnome::Gio::FileIOStream or undefined on error. Free the returned object with g_object_unref()..
open-readwrite-async
Asynchronously opens $file
for reading and writing.
For more details, see .open-readwrite()
which is the synchronous version of this call.
When the operation is finished, $callback
will be called. You can then call .open-readwrite-finish()
to get the result of the operation.
method open-readwrite-async ( Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
open-readwrite-finish
Finishes an asynchronous file read operation started with .open-readwrite-async()
.
method open-readwrite-finish ( N-Object() $res, CArray[N-Error] $err --> N-Object )
$res; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::FileIOStream or undefined on error. Free the returned object with g_object_unref()..
peek-path
Exactly like .get-path()
, but caches the result via g_object_set_qdata_full(). This is useful for example in C applications which mix g_file_*` APIs with native ones. It also avoids an extra duplicated string when possible, so will be generally more efficient.
This call does no blocking I/O.
method peek-path (--> Str )
Return value; string containing the Gnome::Gio::R-File's path, or undefined if no such path exists. The returned string is owned by $file
..
poll-mountable
Polls a file of type G_FILE_TYPE_MOUNTABLE
.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
When the operation is finished, $callback
will be called. You can then call .mount-mountable-finish()
to get the result of the operation.
method poll-mountable ( N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied, or undefined. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
poll-mountable-finish
Finishes a poll operation. See .poll-mountable()
for details.
Finish an asynchronous poll operation that was polled with .poll-mountable()
.
method poll-mountable-finish ( N-Object() $result, CArray[N-Error] $err --> Bool )
$result; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the operation finished successfully. False
otherwise..
query-default-handler
Returns the Gnome::Gio::R-AppInfo that is registered as the default application to handle the file specified by $file
.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method query-default-handler ( N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::R-AppInfo if the handle was found, undefined if there were errors. When you are done with it, release it with g_object_unref().
query-default-handler-async
Async version of .query-default-handler()
.
method query-default-handler-async ( Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is done. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; data to pass to
$callback
.
query-default-handler-finish
Finishes a .query-default-handler-async()
operation.
method query-default-handler-finish ( N-Object() $result, CArray[N-Error] $err --> N-Object )
$result; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::R-AppInfo if the handle was found, undefined if there were errors. When you are done with it, release it with g_object_unref().
query-exists
Utility function to check if a particular file exists. This is implemented using .query-info()
and as such does blocking I/O.
Note that in many cases it is [racy to first check for file existence](https://en.wikipedia.org/wiki/Time_of_check_to_time_of_use) 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 .create()
which will either atomically create the file or fail with a G_IO_ERROR_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.
method query-exists ( N-Object() $cancellable --> Bool )
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
Return value; True
if the file exists (and can be detected without error), False
otherwise (or if cancelled)..
query-file-type
Utility function to inspect the Gnome::Gio::T-ioenums of a file. This is implemented using .query-info()
and as such does blocking I/O.
The primary use case of this method is to check if a file is a regular file, directory, or symlink.
method query-file-type ( UInt $flags, N-Object() $cancellable --> GFileType )
$flags; a set of Gnome::Gio::T-ioenums passed to
.query-info()
.$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
Return value; The Gnome::Gio::T-ioenums of the file and G_FILE_TYPE_UNKNOWN
if the file does not exist.
query-filesystem-info
Similar to .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 defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
If the file does not exist, the G_IO_ERROR_NOT_FOUND
error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
method query-filesystem-info ( Str $attributes, N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$attributes; an attribute query string.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::FileInfo or undefined if there was an error. Free the returned object with g_object_unref()..
query-filesystem-info-async
Asynchronously gets the requested information about the filesystem that the specified $file
is on. The result is a Gnome::Gio::FileInfo object that contains key-value attributes (such as type or size for the file).
For more details, see .query-filesystem-info()
which is the synchronous version of this call.
When the operation is finished, $callback
will be called. You can then call .query-info-finish()
to get the result of the operation.
method query-filesystem-info-async ( Str $attributes, Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$attributes; an attribute query string.
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
query-filesystem-info-finish
Finishes an asynchronous filesystem info query. See .query-filesystem-info-async()
.
method query-filesystem-info-finish ( N-Object() $res, CArray[N-Error] $err --> N-Object )
$res; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; Gnome::Gio::FileInfo for given $file
or undefined on error. Free the returned object with g_object_unref()..
query-info
Gets the requested information about specified $file
. The result is a Gnome::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. $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 be "standard::*,owner::user". The standard attributes are available as defines, like G_FILE_ATTRIBUTE_STANDARD_NAME
.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_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 G_FILE_QUERY_INFO_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 G_IO_ERROR_NOT_FOUND
error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
method query-info ( Str $attributes, UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$attributes; an attribute query string.
$flags; a set of Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::FileInfo for the given $file
, or undefined on error. Free the returned object with g_object_unref()..
query-info-async
Asynchronously gets the requested information about specified $file
. The result is a Gnome::Gio::FileInfo object that contains key-value attributes (such as type or size for the file).
For more details, see .query-info()
which is the synchronous version of this call.
When the operation is finished, $callback
will be called. You can then call .query-info-finish()
to get the result of the operation.
method query-info-async ( Str $attributes, UInt $flags, Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$attributes; an attribute query string.
$flags; a set of Gnome::Gio::T-ioenums.
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
query-info-finish
Finishes an asynchronous file info query. See .query-info-async()
.
method query-info-finish ( N-Object() $res, CArray[N-Error] $err --> N-Object )
$res; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; Gnome::Gio::FileInfo for given $file
or undefined on error. Free the returned object with g_object_unref()..
query-settable-attributes
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 defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method query-settable-attributes ( N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::N-FileAttributeInfoList describing the settable attributes. When you are done with it, release it with .attribute-info-list-unref()
.
query-writable-namespaces
Obtain the list of attribute namespaces where new attributes can be created by a user. An example of this is extended attributes (in the "xattr" namespace).
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method query-writable-namespaces ( N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::N-FileAttributeInfoList describing the writable namespaces. When you are done with it, release it with .attribute-info-list-unref()
.
read
Opens a file for reading. The result is a Gnome::Gio::FileInputStream that can be used to read the contents of the file.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
If the file does not exist, the G_IO_ERROR_NOT_FOUND
error will be returned. If the file is a directory, the G_IO_ERROR_IS_DIRECTORY
error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
method read ( N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$cancellable; a Gnome::Gio::Cancellable.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; Gnome::Gio::FileInputStream or undefined on error. Free the returned object with g_object_unref()..
read-async
Asynchronously opens $file
for reading.
For more details, see .read()
which is the synchronous version of this call.
When the operation is finished, $callback
will be called. You can then call .read-finish()
to get the result of the operation.
method read-async ( Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
read-finish
Finishes an asynchronous file read operation started with .read-async()
.
method read-finish ( N-Object() $res, CArray[N-Error] $err --> N-Object )
$res; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::FileInputStream or undefined on error. Free the returned object with g_object_unref()..
replace
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 G_FILE_CREATE_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 defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
If you pass in a non-undefined $etag
value and $file
already exists, then this value is compared to the current entity tag of the file, and if they differ an G_IO_ERROR_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 .output-stream-get-etag()
after you've finished writing and closed the Gnome::Gio::FileOutputStream. When you load a new file you can use .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 G_IO_ERROR_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 G_IO_ERROR_IS_DIRECTORY
error will be returned, and if the file is some other form of non-regular file then a G_IO_ERROR_NOT_REGULAR_FILE
error will be returned. Some file systems don't allow all file names, and may return an G_IO_ERROR_INVALID_FILENAME
error, and if the name is to long G_IO_ERROR_FILENAME_TOO_LONG
will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
method replace ( Str $etag, Bool() $make-backup, UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$etag; an optional entity tag for the current Gnome::Gio::R-File, or #NULL to ignore.
$make-backup;
True
if a backup should be created.$flags; a set of Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::FileOutputStream or undefined on error. Free the returned object with g_object_unref()..
replace-async
Asynchronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first.
For more details, see .replace()
which is the synchronous version of this call.
When the operation is finished, $callback
will be called. You can then call .replace-finish()
to get the result of the operation.
method replace-async ( Str $etag, Bool() $make-backup, UInt $flags, Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$etag; an entity tag for the current Gnome::Gio::R-File, or undefined to ignore.
$make-backup;
True
if a backup should be created.$flags; a set of Gnome::Gio::T-ioenums.
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
replace-contents
Replaces the contents of $file
with $contents
of $length
bytes.
If $etag
is specified (defined), any existing file must have that etag, or the error G_IO_ERROR_WRONG_ETAG
will be returned.
If $make-backup
is True
, this function will attempt to make a backup of $file
. Internally, it uses .replace()
, so will try to replace the file contents in the safest way possible. For example, atomic renames are used when replacing local files’ contents.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
The returned $new-etag
can be used to verify that the file hasn't changed the next time it is saved over.
method replace-contents ( Str $contents, Int() $length, Str $etag, Bool() $make-backup, UInt $flags, Array[Str] $new-etag, N-Object() $cancellable, CArray[N-Error] $err --> Bool )
$contents; a string containing the new contents for
$file
.$length; the length of
$contents
in bytes.$etag; the old entity-tag for the document, or undefined.
$make-backup;
True
if a backup should be created.$flags; a set of Gnome::Gio::T-ioenums.
$new-etag; (transfer ownership: full) a location to a new entity tag for the document. This should be freed with g_free() when no longer needed, or undefined.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if successful. If an error has occurred, this function will return False
and set $error
appropriately if present..
replace-contents-async
Starts an asynchronous replacement of $file
with the given $contents
of $length
bytes. $etag
will replace the document's current entity tag.
When this operation has completed, $callback
will be called with $user-user
data, and the operation can be finalized with .replace-contents-finish()
.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
If $make-backup
is True
, this function will attempt to make a backup of $file
.
Note that no copy of $contents
will be made, so it must stay valid until $callback
is called. See .replace-contents-bytes-async()
for a Gnome::Glib::N-Bytes version that will automatically hold a reference to the contents (without copying) for the duration of the call.
method replace-contents-async ( Str $contents, Int() $length, Str $etag, Bool() $make-backup, UInt $flags, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$contents; string of contents to replace the file with.
$length; the length of
$contents
in bytes.$etag; a new entity tag for the
$file
, or undefined.$make-backup;
True
if a backup should be created.$flags; a set of Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
replace-contents-bytes-async
Same as .replace-contents-async()
but takes a Gnome::Glib::N-Bytes input instead. This function will keep a ref on $contents
until the operation is done. Unlike .replace-contents-async()
this allows forgetting about the content without waiting for the callback.
When this operation has completed, $callback
will be called with $user-user
data, and the operation can be finalized with .replace-contents-finish()
.
method replace-contents-bytes-async ( N-Object $contents, Str $etag, Bool() $make-backup, UInt $flags, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$contents; a Gnome::Glib::N-Bytes
$etag; a new entity tag for the
$file
, or undefined.$make-backup;
True
if a backup should be created.$flags; a set of Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
replace-contents-finish
Finishes an asynchronous replace of the given $file
. See .replace-contents-async()
. Sets $new-etag
to the new entity tag for the document, if present.
method replace-contents-finish ( N-Object() $res, Array[Str] $new-etag, CArray[N-Error] $err --> Bool )
$res; a Gnome::Gio::R-AsyncResult.
$new-etag; (transfer ownership: full) a location of a new entity tag for the document. This should be freed with g_free() when it is no longer needed, or undefined.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
on success, False
on failure..
replace-finish
Finishes an asynchronous file replace operation started with .replace-async()
.
method replace-finish ( N-Object() $res, CArray[N-Error] $err --> N-Object )
$res; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::FileOutputStream, or undefined on error. Free the returned object with g_object_unref()..
replace-readwrite
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 .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.
method replace-readwrite ( Str $etag, Bool() $make-backup, UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$etag; an optional entity tag for the current Gnome::Gio::R-File, or #NULL to ignore.
$make-backup;
True
if a backup should be created.$flags; a set of Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::FileIOStream or undefined on error. Free the returned object with g_object_unref()..
replace-readwrite-async
Asynchronously overwrites the file in read-write mode, replacing the contents, possibly creating a backup copy of the file first.
For more details, see .replace-readwrite()
which is the synchronous version of this call.
When the operation is finished, $callback
will be called. You can then call .replace-readwrite-finish()
to get the result of the operation.
method replace-readwrite-async ( Str $etag, Bool() $make-backup, UInt $flags, Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$etag; an entity tag for the current Gnome::Gio::R-File, or undefined to ignore.
$make-backup;
True
if a backup should be created.$flags; a set of Gnome::Gio::T-ioenums.
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
replace-readwrite-finish
Finishes an asynchronous file replace operation started with .replace-readwrite-async()
.
method replace-readwrite-finish ( N-Object() $res, CArray[N-Error] $err --> N-Object )
$res; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::FileIOStream, or undefined on error. Free the returned object with g_object_unref()..
resolve-relative-path
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).
method resolve-relative-path ( Str $relative-path --> N-Object )
$relative-path; a given relative path string.
Return value; a Gnome::Gio::R-File for the resolved path..
set-attribute
Sets an attribute in the file with attribute name $attribute
to $value-p
.
Some attributes can be unset by setting $type
to G_FILE_ATTRIBUTE_TYPE_INVALID
and $value-p
to undefined.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method set-attribute ( Str $attribute, GFileAttributeType $type, gpointer $value-p, UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> Bool )
$attribute; a string containing the attribute's name.
$type; The type of the attribute.
$value-p; a pointer to the value (or the pointer itself if the type is a pointer type).
$flags; a set of Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the attribute was set, False
otherwise..
set-attribute-byte-string
Sets $attribute
of type G_FILE_ATTRIBUTE_TYPE_BYTE_STRING
to $value
. If $attribute
is of a different type, this operation will fail, returning False
.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method set-attribute-byte-string ( Str $attribute, Str $value, UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> Bool )
$attribute; a string containing the attribute's name.
$value; a string containing the attribute's new value.
$flags; a Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the $attribute
was successfully set to $value
in the $file
, False
otherwise..
set-attribute-int32
Sets $attribute
of type %G_FILE_ATTRIBUTE_TYPE_INT32 to $value
. If $attribute
is of a different type, this operation will fail.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method set-attribute-int32 ( Str $attribute, Int() $value, UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> Bool )
$attribute; a string containing the attribute's name.
$value; a #gint32 containing the attribute's new value.
$flags; a Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the $attribute
was successfully set to $value
in the $file
, False
otherwise..
set-attribute-int64
Sets $attribute
of type %G_FILE_ATTRIBUTE_TYPE_INT64 to $value
. If $attribute
is of a different type, this operation will fail.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method set-attribute-int64 ( Str $attribute, Int() $value, UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> Bool )
$attribute; a string containing the attribute's name.
$value; a #guint64 containing the attribute's new value.
$flags; a Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the $attribute
was successfully set, False
otherwise..
set-attribute-string
Sets $attribute
of type G_FILE_ATTRIBUTE_TYPE_STRING
to $value
. If $attribute
is of a different type, this operation will fail.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method set-attribute-string ( Str $attribute, Str $value, UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> Bool )
$attribute; a string containing the attribute's name.
$value; a string containing the attribute's value.
$flags; Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the $attribute
was successfully set, False
otherwise..
set-attribute-uint32
Sets $attribute
of type %G_FILE_ATTRIBUTE_TYPE_UINT32 to $value
. If $attribute
is of a different type, this operation will fail.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method set-attribute-uint32 ( Str $attribute, UInt() $value, UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> Bool )
$attribute; a string containing the attribute's name.
$value; a #guint32 containing the attribute's new value.
$flags; a Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the $attribute
was successfully set to $value
in the $file
, False
otherwise..
set-attribute-uint64
Sets $attribute
of type %G_FILE_ATTRIBUTE_TYPE_UINT64 to $value
. If $attribute
is of a different type, this operation will fail.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method set-attribute-uint64 ( Str $attribute, UInt() $value, UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> Bool )
$attribute; a string containing the attribute's name.
$value; a #guint64 containing the attribute's new value.
$flags; a Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the $attribute
was successfully set to $value
in the $file
, False
otherwise..
set-attributes-async
Asynchronously sets the attributes of $file
with $info
.
For more details, see .set-attributes-from-info()
, which is the synchronous version of this call.
When the operation is finished, $callback
will be called. You can then call .set-attributes-finish()
to get the result of the operation.
method set-attributes-async ( N-Object() $info, UInt $flags, Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$info; a Gnome::Gio::FileInfo.
$flags; a Gnome::Gio::T-ioenums.
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; a #gpointer.
set-attributes-finish
Finishes setting an attribute started in .set-attributes-async()
.
method set-attributes-finish ( N-Object() $result, N-Object() $info, CArray[N-Error] $err --> Bool )
$result; a Gnome::Gio::R-AsyncResult.
$info; (transfer ownership: full) a Gnome::Gio::FileInfo.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the attributes were set correctly, False
otherwise..
set-attributes-from-info
Tries to set all attributes in the Gnome::Gio::FileInfo on the target values, not stopping on the first error.
If there is any error during this operation then $error
will be set to the first error. Error on particular fields are flagged by setting the "status" field in the attribute value to G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING
, which means you can also detect further errors.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method set-attributes-from-info ( N-Object() $info, UInt $flags, N-Object() $cancellable, CArray[N-Error] $err --> Bool )
$info; a Gnome::Gio::FileInfo.
$flags; Gnome::Gio::T-ioenums.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; False
if there was any error, True
otherwise..
set-display-name
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 .set-display-name()
.
On success the resulting converted filename is returned.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method set-display-name ( Str $display-name, N-Object() $cancellable, CArray[N-Error] $err --> N-Object )
$display-name; a string.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::R-File specifying what $file
was renamed to, or undefined if there was an error. Free the returned object with g_object_unref()..
set-display-name-async
Asynchronously sets the display name for a given Gnome::Gio::R-File.
For more details, see .set-display-name()
which is the synchronous version of this call.
When the operation is finished, $callback
will be called. You can then call .set-display-name-finish()
to get the result of the operation.
method set-display-name-async ( Str $display-name, Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$display-name; a string.
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
set-display-name-finish
Finishes setting a display name started with .set-display-name-async()
.
method set-display-name-finish ( N-Object() $res, CArray[N-Error] $err --> N-Object )
$res; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; a Gnome::Gio::R-File or undefined on error. Free the returned object with g_object_unref()..
start-mountable
Starts a file of type G_FILE_TYPE_MOUNTABLE
. Using $start-operation
, you can request callbacks when, for instance, passwords are needed during authentication.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
When the operation is finished, $callback
will be called. You can then call .mount-mountable-finish()
to get the result of the operation.
method start-mountable ( UInt $flags, N-Object() $start-operation, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$flags; flags affecting the operation.
$start-operation; a Gnome::Gio::MountOperation, or undefined to avoid user interaction.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied, or undefined. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
start-mountable-finish
Finishes a start operation. See .start-mountable()
for details.
Finish an asynchronous start operation that was started with .start-mountable()
.
method start-mountable-finish ( N-Object() $result, CArray[N-Error] $err --> Bool )
$result; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the operation finished successfully. False
otherwise..
stop-mountable
Stops a file of type G_FILE_TYPE_MOUNTABLE
.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
When the operation is finished, $callback
will be called. You can then call .stop-mountable-finish()
to get the result of the operation.
method stop-mountable ( UInt $flags, N-Object() $mount-operation, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$flags; flags affecting the operation.
$mount-operation; a Gnome::Gio::MountOperation, or undefined to avoid user interaction..
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied, or undefined. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
stop-mountable-finish
Finishes a stop operation, see .stop-mountable()
for details.
Finish an asynchronous stop operation that was started with .stop-mountable()
.
method stop-mountable-finish ( N-Object() $result, CArray[N-Error] $err --> Bool )
$result; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the operation finished successfully. False
otherwise..
supports-thread-contexts
Checks if $file
supports thread-default contexts. If this returns False
, you cannot perform asynchronous operations on $file
in a thread that has a thread-default context.
method supports-thread-contexts (--> Bool )
Return value; Whether or not $file
supports thread-default contexts..
trash
Sends $file
to the "Trashcan", if possible. This is similar to deleting it, but the user can recover it before emptying the trashcan. Not all file systems support trashing, so this call can return the G_IO_ERROR_NOT_SUPPORTED
error. Since GLib 2.66, the x-gvfs-notrash` unix mount option can be used to disable .trash()
support for certain mounts, the G_IO_ERROR_NOT_SUPPORTED
error will be returned in that case.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
method trash ( N-Object() $cancellable, CArray[N-Error] $err --> Bool )
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
on successful trash, False
otherwise..
trash-async
Asynchronously sends $file
to the Trash location, if possible.
method trash-async ( Int() $io-priority, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$io-priority; the I/O priority of the request.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
trash-finish
Finishes an asynchronous file trashing operation, started with .trash-async()
.
method trash-finish ( N-Object() $result, CArray[N-Error] $err --> Bool )
$result; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
on successful trash, False
otherwise..
unmount-mountable
Note: The native version of this routine is deprecated in gio-lib() since version 2.22
Unmounts a file of type G_FILE_TYPE_MOUNTABLE.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
When the operation is finished, $callback
will be called. You can then call .unmount-mountable-finish()
to get the result of the operation.
method unmount-mountable ( UInt $flags, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$flags; flags affecting the operation.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied, or undefined. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
unmount-mountable-finish
Note: The native version of this routine is deprecated in gio-lib() since version 2.22
Finishes an unmount operation, see .unmount-mountable()
for details.
Finish an asynchronous unmount operation that was started with .unmount-mountable()
.
method unmount-mountable-finish ( N-Object() $result, CArray[N-Error] $err --> Bool )
$result; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the operation finished successfully. False
otherwise..
unmount-mountable-with-operation
Unmounts a file of type G_FILE_TYPE_MOUNTABLE
.
If $cancellable
is defined, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned.
When the operation is finished, $callback
will be called. You can then call .unmount-mountable-finish()
to get the result of the operation.
method unmount-mountable-with-operation ( UInt $flags, N-Object() $mount-operation, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$flags; flags affecting the operation.
$mount-operation; a Gnome::Gio::MountOperation, or undefined to avoid user interaction.
$cancellable; optional Gnome::Gio::Cancellable object, undefined to ignore.
GAsyncReadyCallback &callback; a Gnome::Gio::T-iotypes to call when the request is satisfied, or undefined. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data )
.$user-data; the data to pass to callback function.
unmount-mountable-with-operation-finish
Finishes an unmount operation, see .unmount-mountable-with-operation()
for details.
Finish an asynchronous unmount operation that was started with .unmount-mountable-with-operation()
.
method unmount-mountable-with-operation-finish ( N-Object() $result, CArray[N-Error] $err --> Bool )
$result; a Gnome::Gio::R-AsyncResult.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointer
when you want to ignore the error. .
Return value; True
if the operation finished successfully. False
otherwise..