2.17 <GFile>

Interface: <GFile>

<GFile> is a high level abstraction for manipulating files on a virtual file system. <GFile>s are lightweight, immutable objects that do no I/O upon creation. It is necessary to understand that <GFile> objects do not represent files, merely an identifier for a file. All file content I/O is implemented as streaming operations (see <GInputStream> and <GOutputStream>).

To construct a <GFile>, you can use:

One way to think of a <GFile> is as an abstraction of a pathname. For normal files the system pathname is what is stored internally, but as <GFile>s are extensible it could also be something else that corresponds to a pathname in a userspace implementation of a filesystem.

<GFile>s make up hierarchies of directories and files that correspond to the files on a filesystem. You can move through the file system with <GFile> using file:get-parent to get an identifier for the parent directory, file:get-child to get a child within a directory, and file:resolve-relative-path to resolve a relative path between two <GFile>s. There can be multiple hierarchies, so you may not end up at the same root if you repeatedly call file:get-parent on two different files.

All <GFile>s have a basename (get with file: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 file: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 <GFile> to use to actually access the file, because there is no way to go from a display name to the actual name.

Using <GFile> 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 <GFile>s 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 <GFile>s point to the same file you can query for the G_FILE_ATTRIBUTE_ID_FILE attribute. Note that <GFile> 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 <GFile>s.

Many <GFile> 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 GAsyncReadyCallback 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 <GFile> operations almost always take a noticeable amount of time, and so do not have synchronous analogs. Notable cases include:

Entity Tags

One notable feature of <GFile>s 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 description of HTTP ETags in RFC9110. <GFile> Entity Tags are a very similar concept.

Procedures

Method: file:append-to self flags [cancellable] ⇒ %return
Method: append-to self flags [cancellable] ⇒ %return

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 private in flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

Some file systems don’t allow all file names, and may return an invalid-filename error. If the file is a directory the is-directory error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileOutputStream>.

a <GFileOutputStream>, or #f on error. Free the returned object with object:unref.

Method: file:append-to-async self flags io-priority [cancellable] [callback]
Method: append-to-async self flags io-priority [cancellable] [callback]

Asynchronously opens self for appending.

For more details, see file:append-to which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:append-to-finish to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:append-to-finish self res ⇒ %return
Method: append-to-finish self res ⇒ %return

Finishes an asynchronous file append operation started with file:append-to-async.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

<GAsyncResult>

%return

Returned: a <GFileOutputStream>.

a valid <GFileOutputStream> or #f on error. Free the returned object with object:unref.

Method: file:build-attribute-list-for-copy self flags [cancellable] ⇒ %return
Method: build-attribute-list-for-copy self flags [cancellable] ⇒ %return

Prepares the file attribute query string for copying to self.

This function prepares an attribute query string to be passed to file:query-info to get a list of attributes normally copied with the file (see file:copy-attributes? for the detailed description). This function is used by the implementation of file: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).

self

Passed: a <GFile>.

a <GFile> to copy attributes to

flags

Passed: a <GFileCopyFlags>, or a list of its symbols, or one of them.

a set of <GFileCopyFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a string.

an attribute query string for file:query-info, or #f if an error occurs.

Method: file:copy-async self destination flags io-priority cancellable progress-callback-closure ready-callback-closure
Method: copy-async self destination flags io-priority cancellable progress-callback-closure ready-callback-closure

Copies the file self to the location specified by destination asynchronously. For details of the behaviour, see file:copy?.

If progress-callback is not #f, then that function that will be called just like in file:copy?. The callback will run in the default main context of the thread calling file:copy-async — the same context as callback is run in.

When the operation is finished, callback will be called. You can then call file:copy-finish? to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

destination

Passed: a <GFile>.

destination <GFile>

flags

Passed: a <GFileCopyFlags>, or a list of its symbols, or one of them.

set of <GFileCopyFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

progress-callback-closure

Passed: a <GClosure>, or #f.

ready-callback-closure

Passed: a <GClosure>.

progress-callback

function to callback with progress information, or #f if progress information is not needed

See GFileProgressCallback for how it is called.

progress-callback-data

user data to pass to progress-callback

callback

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

the data to pass to callback

Method: file:copy-attributes? self destination flags [cancellable] ⇒ %return
Method: copy-attributes? self destination flags [cancellable] ⇒ %return

Copies the file attributes from self 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 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.

self

Passed: a <GFile>.

a <GFile> with attributes

destination

Passed: a <GFile>.

a <GFile> to copy attributes to

flags

Passed: a <GFileCopyFlags>, or a list of its symbols, or one of them.

a set of <GFileCopyFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t if the attributes were copied successfully, #f otherwise.

Method: file:copy-finish? self res ⇒ %return
Method: copy-finish? self res ⇒ %return

Finishes copying the file started with file:copy-async.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

a #t on success, #f on error.

Method: file:copy? self destination flags [cancellable] [progress-callback] ⇒ %return
Method: copy? self destination flags [cancellable] [progress-callback] ⇒ %return

Copies the file self to the location specified by destination. Can not handle recursive copies of directories.

If the flag overwrite is specified an already existing destination file is overwritten.

If the flag nofollow-symlinks is specified then symlinks will be copied as symlinks, otherwise the target of the self symlink will be copied.

If the flag 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 <GFileInfo>).

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

If progress-callback is not #f, then the operation can be monitored by setting this to a GFileProgressCallback 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 self file does not exist, then the not-found error is returned, independent on the status of the destination.

If overwrite is not specified and the target exists, then the error exists is returned.

If trying to overwrite a file over a directory, the is-directory error is returned. If trying to overwrite a directory with a directory the would-merge error is returned.

If the source is a directory and the target does not exist, or overwrite is specified and the target is a file, then the would-recurse error is returned.

If you are interested in copying the <GFile> object itself (not the on-disk file), see file:dup.

self

Passed: a <GFile>.

input <GFile>

destination

Passed: a <GFile>.

destination <GFile>

flags

Passed: a <GFileCopyFlags>, or a list of its symbols, or one of them.

set of <GFileCopyFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

progress-callback

Passed, or left out: a procedure, or #f.

function to callback with progress information, or #f if progress information is not needed

See GFileProgressCallback for how it is called.

%return

Returned: a boolean.

#t on success, #f otherwise.

progress-callback-data

Not passed: guile-gi supplies it.

user data to pass to progress-callback

Method: file:create self flags [cancellable] ⇒ %return
Method: create self flags [cancellable] ⇒ %return

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 private in flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

If a file or directory with this name already exists the exists error will be returned. Some file systems don’t allow all file names, and may return an invalid-filename error, and if the name is to long filename-too-long will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileOutputStream>.

a <GFileOutputStream> for the newly created file, or #f on error. Free the returned object with object:unref.

Method: file:create-async self flags io-priority [cancellable] [callback]
Method: create-async self flags io-priority [cancellable] [callback]

Asynchronously creates a new file and returns an output stream for writing to it. The file must not already exist.

For more details, see file:create which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:create-finish to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:create-finish self res ⇒ %return
Method: create-finish self res ⇒ %return

Finishes an asynchronous file create operation started with file:create-async.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileOutputStream>.

a <GFileOutputStream> or #f on error. Free the returned object with object:unref.

Method: file:create-readwrite self flags [cancellable] ⇒ %return
Method: create-readwrite self flags [cancellable] ⇒ %return

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 private in flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

If a file or directory with this name already exists, the exists error will be returned. Some file systems don’t allow all file names, and may return an invalid-filename error, and if the name is too long, 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.

self

Passed: a <GFile>.

a <GFile>

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileIOStream>.

a <GFileIOStream> for the newly created file, or #f on error. Free the returned object with object:unref.

Method: file:create-readwrite-async self flags io-priority [cancellable] [callback]
Method: create-readwrite-async self flags io-priority [cancellable] [callback]

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 file:create-readwrite which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:create-readwrite-finish to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:create-readwrite-finish self res ⇒ %return
Method: create-readwrite-finish self res ⇒ %return

Finishes an asynchronous file create operation started with file:create-readwrite-async.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileIOStream>.

a <GFileIOStream> or #f on error. Free the returned object with object:unref.

Method: file:delete-async self io-priority [cancellable] [callback]
Method: delete-async self io-priority [cancellable] [callback]

Asynchronously delete a file. If the self is a directory, it will only be deleted if it is empty. This has the same semantics as unlink.

self

Passed: a <GFile>.

input <GFile>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:delete-finish? self result ⇒ %return
Method: delete-finish? self result ⇒ %return

Finishes deleting a file started with file:delete-async.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the file was deleted. #f otherwise.

Method: file:delete? self [cancellable] ⇒ %return
Method: delete? self [cancellable] ⇒ %return

Deletes a file. If the self is a directory, it will only be deleted if it is empty. This has the same semantics as unlink.

If self doesn’t exist, not-found will be returned. This allows for deletion to be implemented avoiding time-of-check to time-of-use races:


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

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t if the file was deleted. #f otherwise.

Method: file:dup self ⇒ %return
Method: dup self ⇒ %return

Duplicates a <GFile> handle. This operation does not duplicate the actual file or directory represented by the <GFile>; see file:copy? if attempting to copy a file.

file:dup is useful when a second handle is needed to the same underlying file, for use in a separate thread (<GFile> is not thread-safe). For use within the same thread, use object:ref to increment the existing object’s reference count.

This call does no blocking I/O.

self

Passed: a <GFile>.

input <GFile>

%return

Returned: a <GFile>.

a new <GFile> that is a duplicate of the given <GFile>.

Method: file:eject-mountable self flags [cancellable] [callback]
Method: eject-mountable self flags [cancellable] [callback]

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 file:eject-mountable-finish?.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GMountUnmountFlags>, or a list of its symbols, or one of them.

flags affecting the operation

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:eject-mountable-finish? self result ⇒ %return
Method: eject-mountable-finish? self result ⇒ %return

Finishes an asynchronous eject operation started by file:eject-mountable.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the self was ejected successfully. #f otherwise.

Method: file:eject-mountable-with-operation self flags [mount-operation] [cancellable] [callback]
Method: eject-mountable-with-operation self flags [mount-operation] [cancellable] [callback]

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 file:eject-mountable-with-operation-finish?.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GMountUnmountFlags>, or a list of its symbols, or one of them.

flags affecting the operation

mount-operation

Passed, or left out: a <GMountOperation>, or #f.

a <GMountOperation>, or #f to avoid user interaction

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:eject-mountable-with-operation-finish? self result ⇒ %return
Method: eject-mountable-with-operation-finish? self result ⇒ %return

Finishes an asynchronous eject operation started by file:eject-mountable-with-operation.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the self was ejected successfully. #f otherwise.

Method: file:enumerate-children self attributes flags [cancellable] ⇒ %return
Method: enumerate-children self attributes flags [cancellable] ⇒ %return

Gets the requested information about the files in a directory. The result is a FileEnumerator object that will give out 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 FILE_ATTRIBUTE_STANDARD_NAME. FILE_ATTRIBUTE_STANDARD_NAME should always be specified if you plan to call FileEnumerator.get_child or FileEnumerator.iterate on the returned enumerator.

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

If the file does not exist, the Gio.IOErrorEnum.NOT_FOUND error will be returned. If the file is not a directory, the Gio.IOErrorEnum.NOT_DIRECTORY error will be returned. Other errors are possible too.

self

Passed: a <GFile>.

input <GFile>

attributes

Passed: a string.

an attribute query string

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

a set of <GFileQueryInfoFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileEnumerator>.

A <GFileEnumerator> if successful, #f on error. Free the returned object with object:unref.

Method: file:enumerate-children-async self attributes flags io-priority [cancellable] [callback]
Method: enumerate-children-async self attributes flags io-priority [cancellable] [callback]

Asynchronously gets the requested information about the files in a directory. The result is a <GFileEnumerator> object that will give out <GFileInfo> objects for all the files in the directory.

For more details, see file:enumerate-children which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:enumerate-children-finish to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

attributes

Passed: a string.

an attribute query string

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

a set of <GFileQueryInfoFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:enumerate-children-finish self res ⇒ %return
Method: enumerate-children-finish self res ⇒ %return

Finishes an async enumerate children operation. See file:enumerate-children-async.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileEnumerator>.

a <GFileEnumerator> or #f if an error occurred. Free the returned object with object:unref.

Method: file:equal? self file2 ⇒ %return
Method: equal? self file2 ⇒ %return

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

This function can be used with file:hash to insert <GFile>s efficiently in a hash table.

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

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

This call does no blocking I/O.

self

Passed: a <GFile>.

the first <GFile>

file2

Passed: a <GFile>.

the second <GFile>

%return

Returned: a boolean.

#t if self and file2 are equal.

Method: file:find-enclosing-mount self [cancellable] ⇒ %return
Method: find-enclosing-mount self [cancellable] ⇒ %return

Gets a <GMount> for the <GFile>.

<GMount> is returned only for user interesting locations, see <GVolumeMonitor>. If the GFileIface for self does not have a mount, error will be set to not-found and #f will be returned.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GMount>.

a <GMount> where the self is located or #f on error. Free the returned object with object:unref.

Method: file:find-enclosing-mount-async self io-priority [cancellable] [callback]
Method: find-enclosing-mount-async self io-priority [cancellable] [callback]

Asynchronously gets the mount for the file.

For more details, see file:find-enclosing-mount which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:find-enclosing-mount-finish to get the result of the operation.

self

Passed: a <GFile>.

a <GFile>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:find-enclosing-mount-finish self res ⇒ %return
Method: find-enclosing-mount-finish self res ⇒ %return

Finishes an asynchronous find mount request. See file:find-enclosing-mount-async.

self

Passed: a <GFile>.

a <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GMount>.

<GMount> for given self or #f on error. Free the returned object with object:unref.

Method: file:get-basename self ⇒ %return
Method: get-basename self ⇒ %return

Gets the base name (the last component of the path) for a given <GFile>.

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 file:query-info.

This call does no blocking I/O.

self

Passed: a <GFile>.

input <GFile>

%return

Returned: a file name, as a string, or #f.

string containing the <GFile>’s base name, or #f if given <GFile> is invalid. The returned string should be freed with byte-array:free when no longer needed.

Method: file:get-child self name ⇒ %return
Method: get-child self name ⇒ %return

Gets a child of self with basename equal to name.

Note that the file with that specific name might not exist, but you can still have a <GFile> that points to it. You can use this for instance to create that file.

This call does no blocking I/O.

self

Passed: a <GFile>.

input <GFile>

name

Passed: a file name, as a string.

string containing the child’s basename

%return

Returned: a <GFile>.

a <GFile> to a child specified by name. Free the returned object with object:unref.

Method: file:get-child-for-display-name self display-name ⇒ %return
Method: get-child-for-display-name self display-name ⇒ %return

Gets the child of self for a given display-name (i.e. a UTF-8 version of the name). If this function fails, it returns #f and error will be set. This is very useful when constructing a <GFile> 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.

self

Passed: a <GFile>.

input <GFile>

display-name

Passed: a string.

string to a possible child

%return

Returned: a <GFile>.

a <GFile> to the specified child, or #f if the display name couldn’t be converted. Free the returned object with object:unref.

Method: file:get-parent self ⇒ %return
Method: get-parent self ⇒ %return

Gets the parent directory for the self. If the self represents the root directory of the file system, then #f will be returned.

This call does no blocking I/O.

self

Passed: a <GFile>.

input <GFile>

%return

Returned: a <GFile>, or #f.

a <GFile> structure to the parent of the given <GFile> or #f if there is no parent. Free the returned object with object:unref.

Method: file:get-parse-name self ⇒ %return
Method: get-parse-name self ⇒ %return

Gets the parse name of the self. A parse name is a UTF-8 string that describes the file such that one can get the <GFile> back using file-parse-name.

This is generally used to show the <GFile> 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.

self

Passed: a <GFile>.

input <GFile>

%return

Returned: a string.

a string containing the <GFile>’s parse name. The returned string should be freed with byte-array:free when no longer needed.

Method: file:get-path self ⇒ %return
Method: get-path self ⇒ %return

Gets the local pathname for <GFile>, if one exists. If non-#f, this is guaranteed to be an absolute, canonical path. It might contain symlinks.

This call does no blocking I/O.

self

Passed: a <GFile>.

input <GFile>

%return

Returned: a file name, as a string, or #f.

string containing the <GFile>’s path, or #f if no such path exists. The returned string should be freed with byte-array:free when no longer needed.

Method: file:get-relative-path self descendant ⇒ %return
Method: get-relative-path self descendant ⇒ %return

Gets the path for descendant relative to self.

This call does no blocking I/O.

self

Passed: a <GFile>.

input <GFile>

descendant

Passed: a <GFile>.

input <GFile>

%return

Returned: a file name, as a string, or #f.

string with the relative path from descendant to self, or #f if descendant doesn’t have self as prefix. The returned string should be freed with byte-array:free when no longer needed.

Method: file:get-uri self ⇒ %return
Method: get-uri self ⇒ %return

Gets the URI for the self.

This call does no blocking I/O.

self

Passed: a <GFile>.

input <GFile>

%return

Returned: a string.

a string containing the <GFile>’s URI. If the <GFile> was constructed with an invalid URI, an invalid URI is returned. The returned string should be freed with byte-array:free when no longer needed.

Method: file:get-uri-scheme self ⇒ %return
Method: get-uri-scheme self ⇒ %return

Gets the URI scheme for a <GFile>. RFC 3986 decodes the scheme as:


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

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

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

This call does no blocking I/O.

self

Passed: a <GFile>.

input <GFile>

%return

Returned: a string, or #f.

a string containing the URI scheme for the given <GFile> or #f if the <GFile> was constructed with an invalid URI. The returned string should be freed with byte-array:free when no longer needed.

Method: file:has-parent? self [parent] ⇒ %return
Method: has-parent? self [parent] ⇒ %return

Checks if self has a parent, and optionally, if it is parent.

If parent is #f then this function returns #t if self has any parent at all. If parent is non-#f then #t is only returned if self is an immediate child of parent.

self

Passed: a <GFile>.

input <GFile>

parent

Passed, or left out: a <GFile>, or #f.

the parent to check for, or #f

%return

Returned: a boolean.

#t if self is an immediate child of parent (or any parent in the case that parent is #f).

Method: file:has-prefix? self prefix ⇒ %return
Method: has-prefix? self prefix ⇒ %return

Checks whether self has the prefix specified by prefix.

In other words, if the names of initial elements of self’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 <GFile> is not a prefix of itself. If you want to check for equality, use file:equal?.

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

self

Passed: a <GFile>.

input <GFile>

prefix

Passed: a <GFile>.

input <GFile>

%return

Returned: a boolean.

#t if the self’s parent, grandparent, etc is prefix, #f otherwise.

Method: file:has-uri-scheme? self uri-scheme ⇒ %return
Method: has-uri-scheme? self uri-scheme ⇒ %return

Checks to see if a <GFile> has a given URI scheme.

This call does no blocking I/O.

self

Passed: a <GFile>.

input <GFile>

uri-scheme

Passed: a string.

a string containing a URI scheme

%return

Returned: a boolean.

#t if <GFile>’s backend supports the given URI scheme, #f if URI scheme is #f, not supported, or <GFile> is invalid.

Method: file:hash self ⇒ %return
Method: hash self ⇒ %return

Creates a hash value for a <GFile>.

This call does no blocking I/O.

self

Passed: a <GFile>.

gconstpointer to a <GFile>

%return

Returned: an unsigned 32-bit integer.

0 if self is not a valid <GFile>, otherwise an integer that can be used as hash value for the <GFile>. This function is intended for easily hashing a <GFile> to add to a <GHashTable> or similar data structure.

Method: file:is-native? self ⇒ %return
Method: is-native? self ⇒ %return

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 #f, but file:get-path will still return a native path.

This call does no blocking I/O.

self

Passed: a <GFile>.

input <GFile>

%return

Returned: a boolean.

#t if self is native

Method: file:load-bytes self [cancellable] ⇒ %return etag-out
Method: load-bytes self [cancellable] ⇒ %return etag-out

Loads the contents of self and returns it as <GBytes>.

If self is a resource:// based URI, the resulting bytes will reference the embedded resource instead of a copy. Otherwise, this is equivalent to calling file:load-contents and bytes:new-take.

For resources, etag-out will be set to #f.

The data contained in the resulting <GBytes> is always zero-terminated, but this is not included in the <GBytes> length. The resulting <GBytes> should be freed with bytes:unref when no longer in use.

self

Passed: a <GFile>.

a <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable> or #f

%return

Returned: a <GBytes>.

a <GBytes> or #f and error is set

etag-out

Returned: a string, or #f.

a location to place the current entity tag for the file, or #f if the entity tag is not needed

Method: file:load-bytes-async self [cancellable] [callback]
Method: load-bytes-async self [cancellable] [callback]

Asynchronously loads the contents of self as <GBytes>.

If self is a resource:// based URI, the resulting bytes will reference the embedded resource instead of a copy. Otherwise, this is equivalent to calling file:load-contents-async and bytes:new-take.

callback should call file:load-bytes-finish to get the result of this asynchronous operation.

See file:load-bytes for more information.

self

Passed: a <GFile>.

a <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable> or #f

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:load-bytes-finish self result ⇒ %return etag-out
Method: load-bytes-finish self result ⇒ %return etag-out

Completes an asynchronous request to file:load-bytes-async.

For resources, etag-out will be set to #f.

The data contained in the resulting <GBytes> is always zero-terminated, but this is not included in the <GBytes> length. The resulting <GBytes> should be freed with bytes:unref when no longer in use.

See file:load-bytes for more information.

self

Passed: a <GFile>.

a <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult> provided to the callback

%return

Returned: a <GBytes>.

a <GBytes> or #f and error is set

etag-out

Returned: a string, or #f.

a location to place the current entity tag for the file, or #f if the entity tag is not needed

Method: file:load-contents self [cancellable] ⇒ %return contents etag-out
Method: load-contents self [cancellable] ⇒ %return contents etag-out

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 byte-array:free when no longer needed.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t if the self’s contents were successfully loaded. #f if there were errors.

contents

Returned: a bytevector.

a location to place the contents of the file

etag-out

Returned: a string, or #f.

a location to place the current entity tag for the file, or #f if the entity tag is not needed

length

Not returned: it is the length of contents.

a location to place the length of the contents of the file, or #f if the length is not needed

Method: file:load-contents-async self [cancellable] [callback]
Method: load-contents-async self [cancellable] [callback]

Starts an asynchronous load of the self’s contents.

For more details, see file: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 file:load-contents-finish with the <GAsyncResult> returned by the callback.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:load-contents-finish self res ⇒ %return contents etag-out
Method: load-contents-finish self res ⇒ %return contents etag-out

Finishes an asynchronous load of the self’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 byte-array:free when no longer needed. If etag-out is present, it will be set to the new entity tag for the self.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the load was successful. If #f and error is present, it will be set appropriately.

contents

Returned: a bytevector.

a location to place the contents of the file

etag-out

Returned: a string, or #f.

a location to place the current entity tag for the file, or #f if the entity tag is not needed

length

Not returned: it is the length of contents.

a location to place the length of the contents of the file, or #f if the length is not needed

Method: file:load-partial-contents-finish self res ⇒ %return contents etag-out
Method: load-partial-contents-finish self res ⇒ %return contents etag-out

Finishes an asynchronous partial load operation that was started with g_file_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 byte-array:free when no longer needed.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the load was successful. If #f and error is present, it will be set appropriately.

contents

Returned: a bytevector.

a location to place the contents of the file

etag-out

Returned: a string, or #f.

a location to place the current entity tag for the file, or #f if the entity tag is not needed

length

Not returned: it is the length of contents.

a location to place the length of the contents of the file, or #f if the length is not needed

Method: file:make-directory-async self io-priority [cancellable] [callback]
Method: make-directory-async self io-priority [cancellable] [callback]

Asynchronously creates a directory.

self

Passed: a <GFile>.

input <GFile>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:make-directory-finish? self result ⇒ %return
Method: make-directory-finish? self result ⇒ %return

Finishes an asynchronous directory creation, started with file:make-directory-async.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t on successful directory creation, #f otherwise.

Method: file:make-directory-with-parents? self [cancellable] ⇒ %return
Method: make-directory-with-parents? self [cancellable] ⇒ %return

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 not-supported. If the directory itself already exists, this function will fail setting error to exists, unlike the similar mkdir-with-parents.

For a local <GFile> the newly created directories will have the default (current) ownership and permissions of the current process.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t if all directories have been successfully created, #f otherwise.

Method: file:make-directory? self [cancellable] ⇒ %return
Method: make-directory? self [cancellable] ⇒ %return

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 <GFile>. To recursively create directories, see file:make-directory-with-parents?.

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

For a local <GFile> the newly created directory will have the default (current) ownership and permissions of the current process.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t on successful creation, #f otherwise.

Asynchronously creates a symbolic link named self which contains the string symlink-value.

self

Passed: a <GFile>.

a <GFile> with the name of the symlink to create

symlink-value

Passed: a file name, as a string.

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

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Finishes an asynchronous symbolic link creation, started with file:make-symbolic-link-async.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t on successful directory creation, #f otherwise.

Creates a symbolic link named self which contains the string symlink-value.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

a <GFile> with the name of the symlink to create

symlink-value

Passed: a file name, as a string.

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

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t on the creation of a new symlink, #f otherwise.

Method: file:measure-disk-usage self flags [cancellable] [progress-callback] ⇒ %return disk-usage num-dirs num-files
Method: measure-disk-usage self flags [cancellable] [progress-callback] ⇒ %return disk-usage num-dirs num-files

Recursively measures the disk usage of self.

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 report-any-error is given in flags.

The returned size, disk-usage, is in bytes and should be formatted with 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 GFileMeasureProgressCallback for information about when and how the callback will be invoked.

self

Passed: a <GFile>.

a <GFile>

flags

Passed: a <GFileMeasureFlags>, or a list of its symbols, or one of them.

<GFileMeasureFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable>

progress-callback

Passed, or left out: a procedure, or #f.

a GFileMeasureProgressCallback

See GFileMeasureProgressCallback for how it is called.

%return

Returned: a boolean.

#t if successful, with the out parameters set. #f otherwise, with error set.

disk-usage

Returned: an unsigned 64-bit integer.

the number of bytes of disk space used

num-dirs

Returned: an unsigned 64-bit integer.

the number of directories encountered

num-files

Returned: an unsigned 64-bit integer.

the number of non-directories encountered

progress-data

Not passed: guile-gi supplies it.

user_data for progress-callback

Method: file:measure-disk-usage-finish self result ⇒ %return disk-usage num-dirs num-files
Method: measure-disk-usage-finish self result ⇒ %return disk-usage num-dirs num-files

Collects the results from an earlier call to g_file_measure_disk_usage_async(). See file:measure-disk-usage for more information.

self

Passed: a <GFile>.

a <GFile>

result

Passed: a <GAsyncResult>.

the <GAsyncResult> passed to your GAsyncReadyCallback

%return

Returned: a boolean.

#t if successful, with the out parameters set. #f otherwise, with error set.

disk-usage

Returned: an unsigned 64-bit integer.

the number of bytes of disk space used

num-dirs

Returned: an unsigned 64-bit integer.

the number of directories encountered

num-files

Returned: an unsigned 64-bit integer.

the number of non-directories encountered

Method: file:monitor self flags [cancellable] ⇒ %return
Method: monitor self flags [cancellable] ⇒ %return

Obtains a file or directory monitor for the given file, depending on the type of the file.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GFileMonitorFlags>, or a list of its symbols, or one of them.

a set of <GFileMonitorFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileMonitor>.

a <GFileMonitor> for the given self, or #f on error. Free the returned object with object:unref.

Method: file:monitor-directory self flags [cancellable] ⇒ %return
Method: monitor-directory self flags [cancellable] ⇒ %return

Obtains a directory monitor for the given file. This may fail if directory monitoring is not supported.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

It does not make sense for flags to contain 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 file:monitor.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GFileMonitorFlags>, or a list of its symbols, or one of them.

a set of <GFileMonitorFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileMonitor>.

a <GFileMonitor> for the given self, or #f on error. Free the returned object with object:unref.

Method: file:monitor-file self flags [cancellable] ⇒ %return
Method: monitor-file self flags [cancellable] ⇒ %return

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 not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

If flags contains 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 self to be reported. Using this flag may result in an increase in resource usage, and may not have any effect depending on the <GFileMonitor> backend and/or filesystem type.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GFileMonitorFlags>, or a list of its symbols, or one of them.

a set of <GFileMonitorFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileMonitor>.

a <GFileMonitor> for the given self, or #f on error. Free the returned object with object:unref.

Method: file:mount-enclosing-volume self flags [mount-operation] [cancellable] [callback]
Method: mount-enclosing-volume self flags [mount-operation] [cancellable] [callback]

Starts a mount-operation, mounting the volume that contains the file self.

When this operation has completed, callback will be called with user-user data, and the operation can be finalized with file:mount-enclosing-volume-finish?.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GMountMountFlags>, or a list of its symbols, or one of them.

flags affecting the operation

mount-operation

Passed, or left out: a <GMountOperation>, or #f.

a <GMountOperation> or #f to avoid user interaction

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied, or #f

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:mount-enclosing-volume-finish? self result ⇒ %return
Method: mount-enclosing-volume-finish? self result ⇒ %return

Finishes a mount operation started by file:mount-enclosing-volume.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if successful. If an error has occurred, this function will return #f and set error appropriately if present.

Method: file:mount-mountable self flags [mount-operation] [cancellable] [callback]
Method: mount-mountable self flags [mount-operation] [cancellable] [callback]

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 not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

When the operation is finished, callback will be called. You can then call file:mount-mountable-finish to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GMountMountFlags>, or a list of its symbols, or one of them.

flags affecting the operation

mount-operation

Passed, or left out: a <GMountOperation>, or #f.

a <GMountOperation>, or #f to avoid user interaction

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:mount-mountable-finish self result ⇒ %return
Method: mount-mountable-finish self result ⇒ %return

Finishes a mount operation. See file:mount-mountable for details.

Finish an asynchronous mount operation that was started with file:mount-mountable.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFile>.

a <GFile> or #f on error. Free the returned object with object:unref.

Method: file:move-async self destination flags io-priority cancellable progress-callback-closure ready-callback-closure
Method: move-async self destination flags io-priority cancellable progress-callback-closure ready-callback-closure

Asynchronously moves a file self to the location of destination. For details of the behaviour, see file:move?.

If progress-callback is not #f, then that function that will be called just like in file:move?. The callback will run in the default main context of the thread calling file:move-async — the same context as callback is run in.

When the operation is finished, callback will be called. You can then call file:move-finish? to get the result of the operation.

self

Passed: a <GFile>.

<GFile> pointing to the source location

destination

Passed: a <GFile>.

<GFile> pointing to the destination location

flags

Passed: a <GFileCopyFlags>, or a list of its symbols, or one of them.

set of <GFileCopyFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

progress-callback-closure

Passed: a <GClosure>, or #f.

ready-callback-closure

Passed: a <GClosure>.

progress-callback

GFileProgressCallback function for updates

See GFileProgressCallback for how it is called.

progress-callback-data

gpointer to user data for the callback function

callback

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

the data to pass to callback function

Method: file:move-finish? self result ⇒ %return
Method: move-finish? self result ⇒ %return

Finishes an asynchronous file movement, started with file:move-async.

self

Passed: a <GFile>.

input source <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t on successful file move, #f otherwise.

Method: file:move? self destination flags [cancellable] [progress-callback] ⇒ %return
Method: move? self destination flags [cancellable] [progress-callback] ⇒ %return

Tries to move the file or directory self 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 overwrite is specified an already existing destination file is overwritten.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

If progress-callback is not #f, then the operation can be monitored by setting this to a GFileProgressCallback 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 self file does not exist, then the not-found error is returned, independent on the status of the destination.

If overwrite is not specified and the target exists, then the error exists is returned.

If trying to overwrite a file over a directory, the is-directory error is returned. If trying to overwrite a directory with a directory the would-merge error is returned.

If the source is a directory and the target does not exist, or overwrite is specified and the target is a file, then the would-recurse error may be returned (if the native move operation isn’t available).

self

Passed: a <GFile>.

<GFile> pointing to the source location

destination

Passed: a <GFile>.

<GFile> pointing to the destination location

flags

Passed: a <GFileCopyFlags>, or a list of its symbols, or one of them.

set of <GFileCopyFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

progress-callback

Passed, or left out: a procedure, or #f.

GFileProgressCallback function for updates

See GFileProgressCallback for how it is called.

%return

Returned: a boolean.

#t on successful move, #f otherwise.

progress-callback-data

Not passed: guile-gi supplies it.

gpointer to user data for the callback function

Procedure: file:new-build-filenamev args ⇒ %return

Constructs a <GFile> from a vector of elements using the correct separator for filenames.

Using this function is equivalent to calling build-filenamev, followed by file-new-for-path on the result.

args

Passed: a list or vector, each a file name, as a string.

#f-terminated array of strings containing the path elements.

%return

Returned: a <GFile>.

a new <GFile>

Procedure: file:new-for-commandline-arg arg ⇒ %return

Creates a <GFile> 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. <GApplication> also uses UTF-8 but 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 filename.

arg

Passed: a file name, as a string.

a command line string

%return

Returned: a <GFile>.

a new <GFile>. Free the returned object with object:unref.

Procedure: file:new-for-commandline-arg-and-cwd arg cwd ⇒ %return

Creates a <GFile> with the given argument from the command line.

This function is similar to file-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 application-command-line:create-file-for-arg.

arg

Passed: a file name, as a string.

a command line string

cwd

Passed: a file name, as a string.

the current working directory of the commandline

%return

Returned: a <GFile>.

a new <GFile>

Procedure: file:new-for-path path ⇒ %return

Constructs a <GFile> for a given path. This operation never fails, but the returned object might not support any I/O operation if path is malformed.

path

Passed: a file name, as a string.

a string containing a relative or absolute path. The string must be encoded in the glib filename encoding.

%return

Returned: a <GFile>.

a new <GFile> for the given path. Free the returned object with object:unref.

Procedure: file:new-for-uri uri ⇒ %return

Constructs a <GFile> 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.

uri

Passed: a string.

a UTF-8 string containing a URI

%return

Returned: a <GFile>.

a new <GFile> for the given uri. Free the returned object with object:unref.

Procedure: file:new-tmp [tmpl] ⇒ %return iostream

Opens a file in the preferred directory for temporary files (as returned by get-tmp-dir) and returns a <GFile> and <GFileIOStream> 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 #f, a default template is used.

Unlike the other <GFile> constructors, this will return #f if a temporary file could not be created.

tmpl

Passed, or left out: a file name, as a string, or #f.

Template for the file name, as in file-open-tmp, or #f for a default template

%return

Returned: a <GFile>.

a new <GFile>. Free the returned object with object:unref.

iostream

Returned: a <GFileIOStream>.

on return, a <GFileIOStream> for the created file

Procedure: file:new-tmp-async tmpl io-priority [cancellable] [callback]

Asynchronously opens a file in the preferred directory for temporary files (as returned by get-tmp-dir) as file-new-tmp.

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 #f, a default template is used.

tmpl

Passed: a file name, as a string, or #f.

Template for the file name, as in file-open-tmp, or #f for a default template

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is done

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

data to pass to callback

Procedure: file:new-tmp-dir-async tmpl io-priority [cancellable] [callback]

Asynchronously creates a directory in the preferred directory for temporary files (as returned by get-tmp-dir) as dir-make-tmp.

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 #f, a default template is used.

tmpl

Passed: a file name, as a string, or #f.

Template for the file name, as in dir-make-tmp, or #f for a default template

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is done

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

data to pass to callback

Procedure: file:new-tmp-dir-finish result ⇒ %return

Finishes a temporary directory creation started by file-new-tmp-dir-async.

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFile>.

a new <GFile>. Free the returned object with object:unref.

Procedure: file:new-tmp-finish result ⇒ %return iostream

Finishes a temporary file creation started by file-new-tmp-async.

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFile>.

a new <GFile>. Free the returned object with object:unref.

iostream

Returned: a <GFileIOStream>.

on return, a <GFileIOStream> for the created file

Method: file:open-readwrite self [cancellable] ⇒ %return
Method: open-readwrite self [cancellable] ⇒ %return

Opens an existing file for reading and writing. The result is a <GFileIOStream> that can be used to read and write the contents of the file.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

If the file does not exist, the not-found error will be returned. If the file is a directory, the 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.

self

Passed: a <GFile>.

<GFile> to open

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>

%return

Returned: a <GFileIOStream>.

<GFileIOStream> or #f on error. Free the returned object with object:unref.

Method: file:open-readwrite-async self io-priority [cancellable] [callback]
Method: open-readwrite-async self io-priority [cancellable] [callback]

Asynchronously opens self for reading and writing.

For more details, see file:open-readwrite which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:open-readwrite-finish to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:open-readwrite-finish self res ⇒ %return
Method: open-readwrite-finish self res ⇒ %return

Finishes an asynchronous file read operation started with file:open-readwrite-async.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileIOStream>.

a <GFileIOStream> or #f on error. Free the returned object with object:unref.

Procedure: file:parse-name parse-name ⇒ %return

Constructs a <GFile> with the given parse-name (i.e. something given by file: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.

parse-name

Passed: a string.

a file name or path to be parsed

%return

Returned: a <GFile>.

a new <GFile>.

Method: file:peek-path self ⇒ %return
Method: peek-path self ⇒ %return

Exactly like file: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.

self

Passed: a <GFile>.

input <GFile>

%return

Returned: a file name, as a string, or #f.

string containing the <GFile>’s path, or #f if no such path exists. The returned string is owned by self.

Method: file:poll-mountable self [cancellable] [callback]
Method: poll-mountable self [cancellable] [callback]

Polls a file of type mountable.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

When the operation is finished, callback will be called. You can then call file:mount-mountable-finish to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied, or #f

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:poll-mountable-finish? self result ⇒ %return
Method: poll-mountable-finish? self result ⇒ %return

Finishes a poll operation. See file:poll-mountable for details.

Finish an asynchronous poll operation that was polled with file:poll-mountable.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the operation finished successfully. #f otherwise.

Method: file:query-default-handler self [cancellable] ⇒ %return
Method: query-default-handler self [cancellable] ⇒ %return

Returns the <GAppInfo> that is registered as the default application to handle the file specified by self.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

a <GFile> to open

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GAppInfo>.

a <GAppInfo> if the handle was found, #f if there were errors. When you are done with it, release it with object:unref

Method: file:query-default-handler-async self io-priority [cancellable] [callback]
Method: query-default-handler-async self io-priority [cancellable] [callback]

Async version of file:query-default-handler.

self

Passed: a <GFile>.

a <GFile> to open

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is done

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

data to pass to callback

Method: file:query-default-handler-finish self result ⇒ %return
Method: query-default-handler-finish self result ⇒ %return

Finishes a file:query-default-handler-async operation.

self

Passed: a <GFile>.

a <GFile> to open

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GAppInfo>.

a <GAppInfo> if the handle was found, #f if there were errors. When you are done with it, release it with object:unref

Method: file:query-exists? self [cancellable] ⇒ %return
Method: query-exists? self [cancellable] ⇒ %return

Utility function to check if a particular file exists.

The fallback implementation of this API is using file:query-info and therefore may do blocking I/O. To asynchronously query the existence of a file, use file:query-info-async.

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

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

self

Passed: a <GFile>.

input <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t if the file exists (and can be detected without error), #f otherwise (or if cancelled).

Method: file:query-file-type self flags [cancellable] ⇒ %return
Method: query-file-type self flags [cancellable] ⇒ %return

Utility function to inspect the <GFileType> of a file. This is implemented using file: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.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

a set of <GFileQueryInfoFlags> passed to file:query-info

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileType>.

The <GFileType> of the file and unknown if the file does not exist

Method: file:query-filesystem-info self attributes [cancellable] ⇒ %return
Method: query-filesystem-info self attributes [cancellable] ⇒ %return

Similar to file:query-info, but obtains information about the filesystem the self is on, rather than the file itself. For instance the amount of space available and the type of the filesystem.

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

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

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

self

Passed: a <GFile>.

input <GFile>

attributes

Passed: a string.

an attribute query string

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileInfo>.

a <GFileInfo> or #f if there was an error. Free the returned object with object:unref.

Method: file:query-filesystem-info-async self attributes io-priority [cancellable] [callback]
Method: query-filesystem-info-async self attributes io-priority [cancellable] [callback]

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

For more details, see file:query-filesystem-info which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:query-info-finish to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

attributes

Passed: a string.

an attribute query string

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:query-filesystem-info-finish self res ⇒ %return
Method: query-filesystem-info-finish self res ⇒ %return

Finishes an asynchronous filesystem info query. See file:query-filesystem-info-async.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileInfo>.

<GFileInfo> for given self or #f on error. Free the returned object with object:unref.

Method: file:query-info self attributes flags [cancellable] ⇒ %return
Method: query-info self attributes flags [cancellable] ⇒ %return

Gets the requested information about specified self.

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

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

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

  • Gio.FILE_ATTRIBUTE_STANDARD_NAME
  • Gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME

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

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

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

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

self

Passed: a <GFile>.

input file

attributes

Passed: a string.

an attribute query string

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

flags to affect the query operation

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional cancellable object

%return

Returned: a <GFileInfo>.

a <GFileInfo> for the given self

Method: file:query-info-async self attributes flags io-priority [cancellable] [callback]
Method: query-info-async self attributes flags io-priority [cancellable] [callback]

Asynchronously gets the requested information about specified self. The result is a <GFileInfo> object that contains key-value attributes (such as type or size for the file).

For more details, see file:query-info which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:query-info-finish to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

attributes

Passed: a string.

an attribute query string

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

a set of <GFileQueryInfoFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:query-info-finish self res ⇒ %return
Method: query-info-finish self res ⇒ %return

Finishes an asynchronous file info query. See file:query-info-async.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileInfo>.

<GFileInfo> for given self or #f on error. Free the returned object with object:unref.

Method: file:query-settable-attributes self [cancellable] ⇒ %return
Method: query-settable-attributes self [cancellable] ⇒ %return

Obtain the list of settable attributes for the file.

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

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileAttributeInfoList>.

a <GFileAttributeInfoList> describing the settable attributes. When you are done with it, release it with file-attribute-info-list:unref

Method: file:query-writable-namespaces self [cancellable] ⇒ %return
Method: query-writable-namespaces self [cancellable] ⇒ %return

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 not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileAttributeInfoList>.

a <GFileAttributeInfoList> describing the writable namespaces. When you are done with it, release it with file-attribute-info-list:unref

Method: file:read self [cancellable] ⇒ %return
Method: read self [cancellable] ⇒ %return

Opens a file for reading. The result is a <GFileInputStream> that can be used to read the contents of the file.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

If the file does not exist, the not-found error will be returned. If the file is a directory, the is-directory error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

self

Passed: a <GFile>.

<GFile> to read

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>

%return

Returned: a <GFileInputStream>.

<GFileInputStream> or #f on error. Free the returned object with object:unref.

Method: file:read-async self io-priority [cancellable] [callback]
Method: read-async self io-priority [cancellable] [callback]

Asynchronously opens self for reading.

For more details, see file:read which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:read-finish to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:read-finish self res ⇒ %return
Method: read-finish self res ⇒ %return

Finishes an asynchronous file read operation started with file:read-async.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileInputStream>.

a <GFileInputStream> or #f on error. Free the returned object with object:unref.

Method: file:replace self etag make-backup flags [cancellable] ⇒ %return
Method: replace self etag make-backup flags [cancellable] ⇒ %return

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 private in flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

If you pass in a non-#f etag value and self already exists, then this value is compared to the current entity tag of the file, and if they differ an 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 file-output-stream:get-etag after you’ve finished writing and closed the <GFileOutputStream>. When you load a new file you can use file-input-stream:query-info to get the etag of the file.

If make-backup is #t, this function will attempt to make a backup of the current file before overwriting it. If this fails a cant-create-backup error will be returned. If you want to replace anyway, try again with make-backup set to #f.

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

self

Passed: a <GFile>.

input <GFile>

etag

Passed: a string, or #f.

an optional entity tag for the current <GFile>, or NULL to ignore

make-backup

Passed: a boolean.

#t if a backup should be created

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileOutputStream>.

a <GFileOutputStream> or #f on error. Free the returned object with object:unref.

Method: file:replace-async self etag make-backup flags io-priority [cancellable] [callback]
Method: replace-async self etag make-backup flags io-priority [cancellable] [callback]

Asynchronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first.

For more details, see file:replace which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:replace-finish to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

etag

Passed: a string, or #f.

an entity tag for the current <GFile>, or #f to ignore

make-backup

Passed: a boolean.

#t if a backup should be created

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:replace-contents self contents etag make-backup flags [cancellable] ⇒ %return new-etag
Method: replace-contents self contents etag make-backup flags [cancellable] ⇒ %return new-etag

Replaces the contents of self with contents of length bytes.

If etag is specified (not #f), any existing file must have that etag, or the error wrong-etag will be returned.

If make-backup is #t, this function will attempt to make a backup of self. Internally, it uses file: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 not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the 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.

self

Passed: a <GFile>.

input <GFile>

contents

Passed: a bytevector, or a list or vector, each an unsigned 8-bit integer.

a string containing the new contents for self

etag

Passed: a string, or #f.

the old entity-tag for the document, or #f

make-backup

Passed: a boolean.

#t if a backup should be created

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t if successful. If an error has occurred, this function will return #f and set error appropriately if present.

new-etag

Returned: a string, or #f.

a location to a new entity tag for the document. This should be freed with byte-array:free when no longer needed, or #f

length

Not passed: guile-gi gives the length of contents.

the length of contents in bytes

Method: file:replace-contents-async self contents etag make-backup flags [cancellable] [callback]
Method: replace-contents-async self contents etag make-backup flags [cancellable] [callback]

Starts an asynchronous replacement of self 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 file:replace-contents-finish.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

If make-backup is #t, this function will attempt to make a backup of self.

Note that no copy of contents will be made, so it must stay valid until callback is called. See file:replace-contents-bytes-async for a <GBytes> version that will automatically hold a reference to the contents (without copying) for the duration of the call.

self

Passed: a <GFile>.

input <GFile>

contents

Passed: a bytevector, or a list or vector, each an unsigned 8-bit integer.

string of contents to replace the file with

etag

Passed: a string, or #f.

a new entity tag for the self, or #f

make-backup

Passed: a boolean.

#t if a backup should be created

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

length

Not passed: guile-gi gives the length of contents.

the length of contents in bytes

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:replace-contents-bytes-async self contents etag make-backup flags [cancellable] [callback]
Method: replace-contents-bytes-async self contents etag make-backup flags [cancellable] [callback]

Same as file:replace-contents-async but takes a <GBytes> input instead. This function will keep a ref on contents until the operation is done. Unlike file: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 file:replace-contents-finish.

self

Passed: a <GFile>.

input <GFile>

contents

Passed: a <GBytes>.

a <GBytes>

etag

Passed: a string, or #f.

a new entity tag for the self, or #f

make-backup

Passed: a boolean.

#t if a backup should be created

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:replace-contents-finish self res ⇒ %return new-etag
Method: replace-contents-finish self res ⇒ %return new-etag

Finishes an asynchronous replace of the given self. See file:replace-contents-async. Sets new-etag to the new entity tag for the document, if present.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t on success, #f on failure.

new-etag

Returned: a string, or #f.

a location of a new entity tag for the document. This should be freed with byte-array:free when it is no longer needed, or #f

Method: file:replace-finish self res ⇒ %return
Method: replace-finish self res ⇒ %return

Finishes an asynchronous file replace operation started with file:replace-async.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileOutputStream>.

a <GFileOutputStream>, or #f on error. Free the returned object with object:unref.

Method: file:replace-readwrite self etag make-backup flags [cancellable] ⇒ %return
Method: replace-readwrite self etag make-backup flags [cancellable] ⇒ %return

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 file:replace which does the same thing but returns an output stream only.

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

self

Passed: a <GFile>.

a <GFile>

etag

Passed: a string, or #f.

an optional entity tag for the current <GFile>, or NULL to ignore

make-backup

Passed: a boolean.

#t if a backup should be created

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileIOStream>.

a <GFileIOStream> or #f on error. Free the returned object with object:unref.

Method: file:replace-readwrite-async self etag make-backup flags io-priority [cancellable] [callback]
Method: replace-readwrite-async self etag make-backup flags io-priority [cancellable] [callback]

Asynchronously overwrites the file in read-write mode, replacing the contents, possibly creating a backup copy of the file first.

For more details, see file:replace-readwrite which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:replace-readwrite-finish to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

etag

Passed: a string, or #f.

an entity tag for the current <GFile>, or #f to ignore

make-backup

Passed: a boolean.

#t if a backup should be created

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:replace-readwrite-finish self res ⇒ %return
Method: replace-readwrite-finish self res ⇒ %return

Finishes an asynchronous file replace operation started with file:replace-readwrite-async.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileIOStream>.

a <GFileIOStream>, or #f on error. Free the returned object with object:unref.

Method: file:resolve-relative-path self relative-path ⇒ %return
Method: resolve-relative-path self relative-path ⇒ %return

Resolves a relative path for self 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 self path as base).

self

Passed: a <GFile>.

input <GFile>

relative-path

Passed: a file name, as a string.

a given relative path string

%return

Returned: a <GFile>.

a <GFile> for the resolved path.

Method: file:set-attribute-byte-string? self attribute value flags [cancellable] ⇒ %return
Method: set-attribute-byte-string? self attribute value flags [cancellable] ⇒ %return

Sets attribute of type byte-string to value. If attribute is of a different type, this operation will fail, returning #f.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

attribute

Passed: a string.

a string containing the attribute’s name

value

Passed: a string.

a string containing the attribute’s new value

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

a <GFileQueryInfoFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t if the attribute was successfully set to value in the self, #f otherwise.

Method: file:set-attribute-int32? self attribute value flags [cancellable] ⇒ %return
Method: set-attribute-int32? self attribute value flags [cancellable] ⇒ %return

Sets attribute of type int32 to value. If attribute is of a different type, this operation will fail.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

attribute

Passed: a string.

a string containing the attribute’s name

value

Passed: a 32-bit integer.

a gint32 containing the attribute’s new value

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

a <GFileQueryInfoFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t if the attribute was successfully set to value in the self, #f otherwise.

Method: file:set-attribute-int64? self attribute value flags [cancellable] ⇒ %return
Method: set-attribute-int64? self attribute value flags [cancellable] ⇒ %return

Sets attribute of type int64 to value. If attribute is of a different type, this operation will fail.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

attribute

Passed: a string.

a string containing the attribute’s name

value

Passed: a 64-bit integer.

a guint64 containing the attribute’s new value

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

a <GFileQueryInfoFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t if the attribute was successfully set, #f otherwise.

Method: file:set-attribute-string? self attribute value flags [cancellable] ⇒ %return
Method: set-attribute-string? self attribute value flags [cancellable] ⇒ %return

Sets attribute of type string to value. If attribute is of a different type, this operation will fail.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

attribute

Passed: a string.

a string containing the attribute’s name

value

Passed: a string.

a string containing the attribute’s value

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

<GFileQueryInfoFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t if the attribute was successfully set, #f otherwise.

Method: file:set-attribute-uint32? self attribute value flags [cancellable] ⇒ %return
Method: set-attribute-uint32? self attribute value flags [cancellable] ⇒ %return

Sets attribute of type uint32 to value. If attribute is of a different type, this operation will fail.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

attribute

Passed: a string.

a string containing the attribute’s name

value

Passed: an unsigned 32-bit integer.

a guint32 containing the attribute’s new value

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

a <GFileQueryInfoFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t if the attribute was successfully set to value in the self, #f otherwise.

Method: file:set-attribute-uint64? self attribute value flags [cancellable] ⇒ %return
Method: set-attribute-uint64? self attribute value flags [cancellable] ⇒ %return

Sets attribute of type uint64 to value. If attribute is of a different type, this operation will fail.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

attribute

Passed: a string.

a string containing the attribute’s name

value

Passed: an unsigned 64-bit integer.

a guint64 containing the attribute’s new value

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

a <GFileQueryInfoFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t if the attribute was successfully set to value in the self, #f otherwise.

Method: file:set-attribute? self attribute type value-p flags [cancellable] ⇒ %return
Method: set-attribute? self attribute type value-p flags [cancellable] ⇒ %return

Sets an attribute in the file with attribute name attribute to value-p.

Some attributes can be unset by setting type to invalid and value-p to #f.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

attribute

Passed: a string.

a string containing the attribute’s name

type

Passed: a <GFileAttributeType>, or one of its symbols.

The type of the attribute

value-p

Passed: a foreign pointer, or a bytevector, or #f.

a pointer to the value (or the pointer itself if the type is a pointer type)

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

a set of <GFileQueryInfoFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t if the attribute was set, #f otherwise.

Method: file:set-attributes-async self info flags io-priority [cancellable] [callback]
Method: set-attributes-async self info flags io-priority [cancellable] [callback]

Asynchronously sets the attributes of self with info.

For more details, see file: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 file:set-attributes-finish to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

info

Passed: a <GFileInfo>.

a <GFileInfo>

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

a <GFileQueryInfoFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:set-attributes-finish self result ⇒ %return info
Method: set-attributes-finish self result ⇒ %return info

Finishes setting an attribute started in file:set-attributes-async.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the attributes were set correctly, #f otherwise.

info

Returned: a <GFileInfo>.

a <GFileInfo>

Method: file:set-attributes-from-info? self info flags [cancellable] ⇒ %return
Method: set-attributes-from-info? self info flags [cancellable] ⇒ %return

Tries to set all attributes in the <GFileInfo> 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 error-setting, which means you can also detect further errors.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

info

Passed: a <GFileInfo>.

a <GFileInfo>

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

<GFileQueryInfoFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#f if there was any error, #t otherwise.

Method: file:set-display-name self display-name [cancellable] ⇒ %return
Method: set-display-name self display-name [cancellable] ⇒ %return

Renames self 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 self 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 file:set-display-name.

On success the resulting converted filename is returned.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

input <GFile>

display-name

Passed: a string.

a string

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFile>.

a <GFile> specifying what self was renamed to, or #f if there was an error. Free the returned object with object:unref.

Method: file:set-display-name-async self display-name io-priority [cancellable] [callback]
Method: set-display-name-async self display-name io-priority [cancellable] [callback]

Asynchronously sets the display name for a given <GFile>.

For more details, see file:set-display-name which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:set-display-name-finish to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

display-name

Passed: a string.

a string

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:set-display-name-finish self res ⇒ %return
Method: set-display-name-finish self res ⇒ %return

Finishes setting a display name started with file:set-display-name-async.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFile>.

a <GFile> or #f on error. Free the returned object with object:unref.

Method: file:start-mountable self flags [start-operation] [cancellable] [callback]
Method: start-mountable self flags [start-operation] [cancellable] [callback]

Starts a file of type mountable. Using start-operation, you can request callbacks when, for instance, passwords are needed during authentication.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

When the operation is finished, callback will be called. You can then call file:mount-mountable-finish to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GDriveStartFlags>, or a list of its symbols, or one of them.

flags affecting the operation

start-operation

Passed, or left out: a <GMountOperation>, or #f.

a <GMountOperation>, or #f to avoid user interaction

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied, or #f

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:start-mountable-finish? self result ⇒ %return
Method: start-mountable-finish? self result ⇒ %return

Finishes a start operation. See file:start-mountable for details.

Finish an asynchronous start operation that was started with file:start-mountable.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the operation finished successfully. #f otherwise.

Method: file:stop-mountable self flags [mount-operation] [cancellable] [callback]
Method: stop-mountable self flags [mount-operation] [cancellable] [callback]

Stops a file of type mountable.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

When the operation is finished, callback will be called. You can then call file:stop-mountable-finish? to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GMountUnmountFlags>, or a list of its symbols, or one of them.

flags affecting the operation

mount-operation

Passed, or left out: a <GMountOperation>, or #f.

a <GMountOperation>, or #f to avoid user interaction.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied, or #f

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:stop-mountable-finish? self result ⇒ %return
Method: stop-mountable-finish? self result ⇒ %return

Finishes a stop operation, see file:stop-mountable for details.

Finish an asynchronous stop operation that was started with file:stop-mountable.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the operation finished successfully. #f otherwise.

Method: file:supports-thread-contexts? self ⇒ %return
Method: supports-thread-contexts? self ⇒ %return

Checks if self supports thread-default main contexts (see main-context:push-thread-default) If this returns #f, you cannot perform asynchronous operations on self in a thread that has a thread-default context.

self

Passed: a <GFile>.

a <GFile>

%return

Returned: a boolean.

Whether or not self supports thread-default contexts.

Method: file:trash-async self io-priority [cancellable] [callback]
Method: trash-async self io-priority [cancellable] [callback]

Asynchronously sends self to the Trash location, if possible.

self

Passed: a <GFile>.

input <GFile>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:trash-finish? self result ⇒ %return
Method: trash-finish? self result ⇒ %return

Finishes an asynchronous file trashing operation, started with file:trash-async.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t on successful trash, #f otherwise.

Method: file:trash? self [cancellable] ⇒ %return
Method: trash? self [cancellable] ⇒ %return

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

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

self

Passed: a <GFile>.

<GFile> to send to trash

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t on successful trash, #f otherwise.

Method: file:unmount-mountable self flags [cancellable] [callback]
Method: unmount-mountable self flags [cancellable] [callback]

Unmounts a file of type G_FILE_TYPE_MOUNTABLE.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

When the operation is finished, callback will be called. You can then call file:unmount-mountable-finish? to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GMountUnmountFlags>, or a list of its symbols, or one of them.

flags affecting the operation

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:unmount-mountable-finish? self result ⇒ %return
Method: unmount-mountable-finish? self result ⇒ %return

Finishes an unmount operation, see file:unmount-mountable for details.

Finish an asynchronous unmount operation that was started with file:unmount-mountable.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the operation finished successfully. #f otherwise.

Method: file:unmount-mountable-with-operation self flags [mount-operation] [cancellable] [callback]
Method: unmount-mountable-with-operation self flags [mount-operation] [cancellable] [callback]

Unmounts a file of type mountable.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

When the operation is finished, callback will be called. You can then call file:unmount-mountable-finish? to get the result of the operation.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GMountUnmountFlags>, or a list of its symbols, or one of them.

flags affecting the operation

mount-operation

Passed, or left out: a <GMountOperation>, or #f.

a <GMountOperation>, or #f to avoid user interaction

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: file:unmount-mountable-with-operation-finish? self result ⇒ %return
Method: unmount-mountable-with-operation-finish? self result ⇒ %return

Finishes an unmount operation, see file:unmount-mountable-with-operation for details.

Finish an asynchronous unmount operation that was started with file:unmount-mountable-with-operation.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the operation finished successfully. #f otherwise.

Virtual methods

Virtual method: file:do-append-to implementor self flags [cancellable] ⇒ %return

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 private in flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

Some file systems don’t allow all file names, and may return an invalid-filename error. If the file is a directory the is-directory error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

To override it in a new class, give register-type #:vfuncs `((append-to . ,procedure)). The procedure is called as (procedure self flags cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileOutputStream>.

a <GFileOutputStream>, or #f on error. Free the returned object with object:unref.

Virtual method: file:do-append-to-async implementor self flags io-priority [cancellable] [callback]

Asynchronously opens self for appending.

For more details, see file:append-to which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:append-to-finish to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((append-to-async . ,procedure)). The procedure is called as (procedure self flags io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-append-to-finish implementor self res ⇒ %return

Finishes an asynchronous file append operation started with file:append-to-async.

To override it in a new class, give register-type #:vfuncs `((append-to-finish . ,procedure)). The procedure is called as (procedure self res) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

<GAsyncResult>

%return

Returned: a <GFileOutputStream>.

a valid <GFileOutputStream> or #f on error. Free the returned object with object:unref.

Virtual method: file:do-copy implementor self destination flags [cancellable] [progress-callback] ⇒ %return

Copies the file self to the location specified by destination. Can not handle recursive copies of directories.

If the flag overwrite is specified an already existing destination file is overwritten.

If the flag nofollow-symlinks is specified then symlinks will be copied as symlinks, otherwise the target of the self symlink will be copied.

If the flag 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 <GFileInfo>).

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

If progress-callback is not #f, then the operation can be monitored by setting this to a GFileProgressCallback 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 self file does not exist, then the not-found error is returned, independent on the status of the destination.

If overwrite is not specified and the target exists, then the error exists is returned.

If trying to overwrite a file over a directory, the is-directory error is returned. If trying to overwrite a directory with a directory the would-merge error is returned.

If the source is a directory and the target does not exist, or overwrite is specified and the target is a file, then the would-recurse error is returned.

If you are interested in copying the <GFile> object itself (not the on-disk file), see file:dup.

To override it in a new class, give register-type #:vfuncs `((copy . ,procedure)). The procedure is called as (procedure self destination flags cancellable progress-callback progress-callback-data) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

destination

Passed: a <GFile>.

destination <GFile>

flags

Passed: a <GFileCopyFlags>, or a list of its symbols, or one of them.

set of <GFileCopyFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

progress-callback

Passed, or left out: a procedure, or #f.

function to callback with progress information, or #f if progress information is not needed

See GFileProgressCallback for how it is called.

%return

Returned: a boolean.

#t on success, #f otherwise.

progress-callback-data

Not passed: guile-gi supplies it.

user data to pass to progress-callback

Virtual method: file:do-copy-async implementor self destination flags io-priority [cancellable] [progress-callback] [callback]

Copies the file self to the location specified by destination asynchronously. For details of the behaviour, see file:copy?.

If progress-callback is not #f, then that function that will be called just like in file:copy?. The callback will run in the default main context of the thread calling file:copy-async — the same context as callback is run in.

When the operation is finished, callback will be called. You can then call file:copy-finish? to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((copy-async . ,procedure)). The procedure is called as (procedure self destination flags io-priority cancellable progress-callback progress-callback-data callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

destination

Passed: a <GFile>.

destination <GFile>

flags

Passed: a <GFileCopyFlags>, or a list of its symbols, or one of them.

set of <GFileCopyFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

progress-callback

Passed, or left out: a procedure, or #f.

function to callback with progress information, or #f if progress information is not needed

See GFileProgressCallback for how it is called.

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

progress-callback-data

Not passed: guile-gi supplies it.

user data to pass to progress-callback

user-data

Not passed: guile-gi supplies it.

the data to pass to callback

Virtual method: file:do-copy-finish implementor self res ⇒ %return

Finishes copying the file started with file:copy-async.

To override it in a new class, give register-type #:vfuncs `((copy-finish . ,procedure)). The procedure is called as (procedure self res) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

a #t on success, #f on error.

Virtual method: file:do-create implementor self flags [cancellable] ⇒ %return

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 private in flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

If a file or directory with this name already exists the exists error will be returned. Some file systems don’t allow all file names, and may return an invalid-filename error, and if the name is to long filename-too-long will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

To override it in a new class, give register-type #:vfuncs `((create . ,procedure)). The procedure is called as (procedure self flags cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileOutputStream>.

a <GFileOutputStream> for the newly created file, or #f on error. Free the returned object with object:unref.

Virtual method: file:do-create-async implementor self flags io-priority [cancellable] [callback]

Asynchronously creates a new file and returns an output stream for writing to it. The file must not already exist.

For more details, see file:create which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:create-finish to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((create-async . ,procedure)). The procedure is called as (procedure self flags io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-create-finish implementor self res ⇒ %return

Finishes an asynchronous file create operation started with file:create-async.

To override it in a new class, give register-type #:vfuncs `((create-finish . ,procedure)). The procedure is called as (procedure self res) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileOutputStream>.

a <GFileOutputStream> or #f on error. Free the returned object with object:unref.

Virtual method: file:do-create-readwrite implementor self flags [cancellable] ⇒ %return

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 private in flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

If a file or directory with this name already exists, the exists error will be returned. Some file systems don’t allow all file names, and may return an invalid-filename error, and if the name is too long, 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.

To override it in a new class, give register-type #:vfuncs `((create-readwrite . ,procedure)). The procedure is called as (procedure self flags cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

a <GFile>

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileIOStream>.

a <GFileIOStream> for the newly created file, or #f on error. Free the returned object with object:unref.

Virtual method: file:do-create-readwrite-async implementor self flags io-priority [cancellable] [callback]

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 file:create-readwrite which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:create-readwrite-finish to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((create-readwrite-async . ,procedure)). The procedure is called as (procedure self flags io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-create-readwrite-finish implementor self res ⇒ %return

Finishes an asynchronous file create operation started with file:create-readwrite-async.

To override it in a new class, give register-type #:vfuncs `((create-readwrite-finish . ,procedure)). The procedure is called as (procedure self res) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileIOStream>.

a <GFileIOStream> or #f on error. Free the returned object with object:unref.

Virtual method: file:do-delete-file implementor self [cancellable] ⇒ %return

Deletes a file. If the self is a directory, it will only be deleted if it is empty. This has the same semantics as unlink.

If self doesn’t exist, not-found will be returned. This allows for deletion to be implemented avoiding time-of-check to time-of-use races:


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

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

To override it in a new class, give register-type #:vfuncs `((delete-file . ,procedure)). The procedure is called as (procedure self cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t if the file was deleted. #f otherwise.

Virtual method: file:do-delete-file-async implementor self io-priority [cancellable] [callback]

Asynchronously delete a file. If the self is a directory, it will only be deleted if it is empty. This has the same semantics as unlink.

To override it in a new class, give register-type #:vfuncs `((delete-file-async . ,procedure)). The procedure is called as (procedure self io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-delete-file-finish implementor self result ⇒ %return

Finishes deleting a file started with file:delete-async.

To override it in a new class, give register-type #:vfuncs `((delete-file-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the file was deleted. #f otherwise.

Virtual method: file:do-dup implementor self ⇒ %return

Duplicates a <GFile> handle. This operation does not duplicate the actual file or directory represented by the <GFile>; see file:copy? if attempting to copy a file.

file:dup is useful when a second handle is needed to the same underlying file, for use in a separate thread (<GFile> is not thread-safe). For use within the same thread, use object:ref to increment the existing object’s reference count.

This call does no blocking I/O.

To override it in a new class, give register-type #:vfuncs `((dup . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

%return

Returned: a <GFile>.

a new <GFile> that is a duplicate of the given <GFile>.

Virtual method: file:do-eject-mountable implementor self flags [cancellable] [callback]

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 file:eject-mountable-finish?.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

To override it in a new class, give register-type #:vfuncs `((eject-mountable . ,procedure)). The procedure is called as (procedure self flags cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GMountUnmountFlags>, or a list of its symbols, or one of them.

flags affecting the operation

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-eject-mountable-finish implementor self result ⇒ %return

Finishes an asynchronous eject operation started by file:eject-mountable.

To override it in a new class, give register-type #:vfuncs `((eject-mountable-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the self was ejected successfully. #f otherwise.

Virtual method: file:do-eject-mountable-with-operation implementor self flags [mount-operation] [cancellable] [callback]

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 file:eject-mountable-with-operation-finish?.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

To override it in a new class, give register-type #:vfuncs `((eject-mountable-with-operation . ,procedure)). The procedure is called as (procedure self flags mount-operation cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GMountUnmountFlags>, or a list of its symbols, or one of them.

flags affecting the operation

mount-operation

Passed, or left out: a <GMountOperation>, or #f.

a <GMountOperation>, or #f to avoid user interaction

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-eject-mountable-with-operation-finish implementor self result ⇒ %return

Finishes an asynchronous eject operation started by file:eject-mountable-with-operation.

To override it in a new class, give register-type #:vfuncs `((eject-mountable-with-operation-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the self was ejected successfully. #f otherwise.

Virtual method: file:do-enumerate-children implementor self attributes flags [cancellable] ⇒ %return

Gets the requested information about the files in a directory. The result is a FileEnumerator object that will give out 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 FILE_ATTRIBUTE_STANDARD_NAME. FILE_ATTRIBUTE_STANDARD_NAME should always be specified if you plan to call FileEnumerator.get_child or FileEnumerator.iterate on the returned enumerator.

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

If the file does not exist, the Gio.IOErrorEnum.NOT_FOUND error will be returned. If the file is not a directory, the Gio.IOErrorEnum.NOT_DIRECTORY error will be returned. Other errors are possible too.

To override it in a new class, give register-type #:vfuncs `((enumerate-children . ,procedure)). The procedure is called as (procedure self attributes flags cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

attributes

Passed: a string.

an attribute query string

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

a set of <GFileQueryInfoFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileEnumerator>.

A <GFileEnumerator> if successful, #f on error. Free the returned object with object:unref.

Virtual method: file:do-enumerate-children-async implementor self attributes flags io-priority [cancellable] [callback]

Asynchronously gets the requested information about the files in a directory. The result is a <GFileEnumerator> object that will give out <GFileInfo> objects for all the files in the directory.

For more details, see file:enumerate-children which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:enumerate-children-finish to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((enumerate-children-async . ,procedure)). The procedure is called as (procedure self attributes flags io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

attributes

Passed: a string.

an attribute query string

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

a set of <GFileQueryInfoFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-enumerate-children-finish implementor self res ⇒ %return

Finishes an async enumerate children operation. See file:enumerate-children-async.

To override it in a new class, give register-type #:vfuncs `((enumerate-children-finish . ,procedure)). The procedure is called as (procedure self res) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileEnumerator>.

a <GFileEnumerator> or #f if an error occurred. Free the returned object with object:unref.

Virtual method: file:do-equal implementor self file2 ⇒ %return

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

This function can be used with file:hash to insert <GFile>s efficiently in a hash table.

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

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

This call does no blocking I/O.

To override it in a new class, give register-type #:vfuncs `((equal . ,procedure)). The procedure is called as (procedure self file2) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

the first <GFile>

file2

Passed: a <GFile>.

the second <GFile>

%return

Returned: a boolean.

#t if self and file2 are equal.

Virtual method: file:do-find-enclosing-mount implementor self [cancellable] ⇒ %return

Gets a <GMount> for the <GFile>.

<GMount> is returned only for user interesting locations, see <GVolumeMonitor>. If the GFileIface for self does not have a mount, error will be set to not-found and #f will be returned.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

To override it in a new class, give register-type #:vfuncs `((find-enclosing-mount . ,procedure)). The procedure is called as (procedure self cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GMount>.

a <GMount> where the self is located or #f on error. Free the returned object with object:unref.

Virtual method: file:do-find-enclosing-mount-async implementor self io-priority [cancellable] [callback]

Asynchronously gets the mount for the file.

For more details, see file:find-enclosing-mount which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:find-enclosing-mount-finish to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((find-enclosing-mount-async . ,procedure)). The procedure is called as (procedure self io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

a <GFile>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-find-enclosing-mount-finish implementor self res ⇒ %return

Finishes an asynchronous find mount request. See file:find-enclosing-mount-async.

To override it in a new class, give register-type #:vfuncs `((find-enclosing-mount-finish . ,procedure)). The procedure is called as (procedure self res) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

a <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GMount>.

<GMount> for given self or #f on error. Free the returned object with object:unref.

Virtual method: file:do-get-basename implementor self ⇒ %return

Gets the base name (the last component of the path) for a given <GFile>.

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 file:query-info.

This call does no blocking I/O.

To override it in a new class, give register-type #:vfuncs `((get-basename . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

%return

Returned: a file name, as a string, or #f.

string containing the <GFile>’s base name, or #f if given <GFile> is invalid. The returned string should be freed with byte-array:free when no longer needed.

Virtual method: file:do-get-child-for-display-name implementor self display-name ⇒ %return

Gets the child of self for a given display-name (i.e. a UTF-8 version of the name). If this function fails, it returns #f and error will be set. This is very useful when constructing a <GFile> 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.

To override it in a new class, give register-type #:vfuncs `((get-child-for-display-name . ,procedure)). The procedure is called as (procedure self display-name) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

display-name

Passed: a string.

string to a possible child

%return

Returned: a <GFile>.

a <GFile> to the specified child, or #f if the display name couldn’t be converted. Free the returned object with object:unref.

Virtual method: file:do-get-parent implementor self ⇒ %return

Gets the parent directory for the self. If the self represents the root directory of the file system, then #f will be returned.

This call does no blocking I/O.

To override it in a new class, give register-type #:vfuncs `((get-parent . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

%return

Returned: a <GFile>, or #f.

a <GFile> structure to the parent of the given <GFile> or #f if there is no parent. Free the returned object with object:unref.

Virtual method: file:do-get-parse-name implementor self ⇒ %return

Gets the parse name of the self. A parse name is a UTF-8 string that describes the file such that one can get the <GFile> back using file-parse-name.

This is generally used to show the <GFile> 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.

To override it in a new class, give register-type #:vfuncs `((get-parse-name . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

%return

Returned: a string.

a string containing the <GFile>’s parse name. The returned string should be freed with byte-array:free when no longer needed.

Virtual method: file:do-get-path implementor self ⇒ %return

Gets the local pathname for <GFile>, if one exists. If non-#f, this is guaranteed to be an absolute, canonical path. It might contain symlinks.

This call does no blocking I/O.

To override it in a new class, give register-type #:vfuncs `((get-path . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

%return

Returned: a file name, as a string, or #f.

string containing the <GFile>’s path, or #f if no such path exists. The returned string should be freed with byte-array:free when no longer needed.

Virtual method: file:do-get-relative-path implementor self descendant ⇒ %return

Gets the path for descendant relative to self.

This call does no blocking I/O.

To override it in a new class, give register-type #:vfuncs `((get-relative-path . ,procedure)). The procedure is called as (procedure self descendant) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

descendant

Passed: a <GFile>.

input <GFile>

%return

Returned: a file name, as a string, or #f.

string with the relative path from descendant to self, or #f if descendant doesn’t have self as prefix. The returned string should be freed with byte-array:free when no longer needed.

Virtual method: file:do-get-uri implementor self ⇒ %return

Gets the URI for the self.

This call does no blocking I/O.

To override it in a new class, give register-type #:vfuncs `((get-uri . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

%return

Returned: a string.

a string containing the <GFile>’s URI. If the <GFile> was constructed with an invalid URI, an invalid URI is returned. The returned string should be freed with byte-array:free when no longer needed.

Virtual method: file:do-get-uri-scheme implementor self ⇒ %return

Gets the URI scheme for a <GFile>. RFC 3986 decodes the scheme as:


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

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

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

This call does no blocking I/O.

To override it in a new class, give register-type #:vfuncs `((get-uri-scheme . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

%return

Returned: a string, or #f.

a string containing the URI scheme for the given <GFile> or #f if the <GFile> was constructed with an invalid URI. The returned string should be freed with byte-array:free when no longer needed.

Virtual method: file:do-has-uri-scheme implementor self uri-scheme ⇒ %return

Checks to see if a <GFile> has a given URI scheme.

This call does no blocking I/O.

To override it in a new class, give register-type #:vfuncs `((has-uri-scheme . ,procedure)). The procedure is called as (procedure self uri-scheme) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

uri-scheme

Passed: a string.

a string containing a URI scheme

%return

Returned: a boolean.

#t if <GFile>’s backend supports the given URI scheme, #f if URI scheme is #f, not supported, or <GFile> is invalid.

Virtual method: file:do-hash implementor self ⇒ %return

Creates a hash value for a <GFile>.

This call does no blocking I/O.

To override it in a new class, give register-type #:vfuncs `((hash . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

gconstpointer to a <GFile>

%return

Returned: an unsigned 32-bit integer.

0 if self is not a valid <GFile>, otherwise an integer that can be used as hash value for the <GFile>. This function is intended for easily hashing a <GFile> to add to a <GHashTable> or similar data structure.

Virtual method: file:do-is-native implementor self ⇒ %return

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 #f, but file:get-path will still return a native path.

This call does no blocking I/O.

To override it in a new class, give register-type #:vfuncs `((is-native . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

%return

Returned: a boolean.

#t if self is native

Virtual method: file:do-make-directory implementor self [cancellable] ⇒ %return

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 <GFile>. To recursively create directories, see file:make-directory-with-parents?.

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

For a local <GFile> the newly created directory will have the default (current) ownership and permissions of the current process.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

To override it in a new class, give register-type #:vfuncs `((make-directory . ,procedure)). The procedure is called as (procedure self cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t on successful creation, #f otherwise.

Virtual method: file:do-make-directory-async implementor self io-priority [cancellable] [callback]

Asynchronously creates a directory.

To override it in a new class, give register-type #:vfuncs `((make-directory-async . ,procedure)). The procedure is called as (procedure self io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-make-directory-finish implementor self result ⇒ %return

Finishes an asynchronous directory creation, started with file:make-directory-async.

To override it in a new class, give register-type #:vfuncs `((make-directory-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t on successful directory creation, #f otherwise.

Creates a symbolic link named self which contains the string symlink-value.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

To override it in a new class, give register-type #:vfuncs `((make-symbolic-link . ,procedure)). The procedure is called as (procedure self symlink-value cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

a <GFile> with the name of the symlink to create

symlink-value

Passed: a file name, as a string.

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

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t on the creation of a new symlink, #f otherwise.

Asynchronously creates a symbolic link named self which contains the string symlink-value.

To override it in a new class, give register-type #:vfuncs `((make-symbolic-link-async . ,procedure)). The procedure is called as (procedure self symlink-value io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

a <GFile> with the name of the symlink to create

symlink-value

Passed: a file name, as a string.

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

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Finishes an asynchronous symbolic link creation, started with file:make-symbolic-link-async.

To override it in a new class, give register-type #:vfuncs `((make-symbolic-link-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t on successful directory creation, #f otherwise.

Virtual method: file:do-measure-disk-usage implementor self flags [cancellable] [progress-callback] ⇒ %return disk-usage num-dirs num-files

Recursively measures the disk usage of self.

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 report-any-error is given in flags.

The returned size, disk-usage, is in bytes and should be formatted with 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 GFileMeasureProgressCallback for information about when and how the callback will be invoked.

To override it in a new class, give register-type #:vfuncs `((measure-disk-usage . ,procedure)). The procedure is called as (procedure self flags cancellable progress-callback progress-data) ⇒ %return disk-usage num-dirs num-files.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

a <GFile>

flags

Passed: a <GFileMeasureFlags>, or a list of its symbols, or one of them.

<GFileMeasureFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable>

progress-callback

Passed, or left out: a procedure, or #f.

a GFileMeasureProgressCallback

See GFileMeasureProgressCallback for how it is called.

%return

Returned: a boolean.

#t if successful, with the out parameters set. #f otherwise, with error set.

disk-usage

Returned: an unsigned 64-bit integer.

the number of bytes of disk space used

num-dirs

Returned: an unsigned 64-bit integer.

the number of directories encountered

num-files

Returned: an unsigned 64-bit integer.

the number of non-directories encountered

progress-data

Not passed: guile-gi supplies it.

user_data for progress-callback

Virtual method: file:do-measure-disk-usage-finish implementor self result ⇒ %return disk-usage num-dirs num-files

Collects the results from an earlier call to g_file_measure_disk_usage_async(). See file:measure-disk-usage for more information.

To override it in a new class, give register-type #:vfuncs `((measure-disk-usage-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return disk-usage num-dirs num-files.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

a <GFile>

result

Passed: a <GAsyncResult>.

the <GAsyncResult> passed to your GAsyncReadyCallback

%return

Returned: a boolean.

#t if successful, with the out parameters set. #f otherwise, with error set.

disk-usage

Returned: an unsigned 64-bit integer.

the number of bytes of disk space used

num-dirs

Returned: an unsigned 64-bit integer.

the number of directories encountered

num-files

Returned: an unsigned 64-bit integer.

the number of non-directories encountered

Virtual method: file:do-monitor-dir implementor self flags [cancellable] ⇒ %return

Obtains a directory monitor for the given file. This may fail if directory monitoring is not supported.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

It does not make sense for flags to contain 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 file:monitor.

To override it in a new class, give register-type #:vfuncs `((monitor-dir . ,procedure)). The procedure is called as (procedure self flags cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GFileMonitorFlags>, or a list of its symbols, or one of them.

a set of <GFileMonitorFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileMonitor>.

a <GFileMonitor> for the given self, or #f on error. Free the returned object with object:unref.

Virtual method: file:do-monitor-file implementor self flags [cancellable] ⇒ %return

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 not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

If flags contains 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 self to be reported. Using this flag may result in an increase in resource usage, and may not have any effect depending on the <GFileMonitor> backend and/or filesystem type.

To override it in a new class, give register-type #:vfuncs `((monitor-file . ,procedure)). The procedure is called as (procedure self flags cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GFileMonitorFlags>, or a list of its symbols, or one of them.

a set of <GFileMonitorFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileMonitor>.

a <GFileMonitor> for the given self, or #f on error. Free the returned object with object:unref.

Virtual method: file:do-mount-enclosing-volume implementor self flags [mount-operation] [cancellable] [callback]

Starts a mount-operation, mounting the volume that contains the file self.

When this operation has completed, callback will be called with user-user data, and the operation can be finalized with file:mount-enclosing-volume-finish?.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

To override it in a new class, give register-type #:vfuncs `((mount-enclosing-volume . ,procedure)). The procedure is called as (procedure self flags mount-operation cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GMountMountFlags>, or a list of its symbols, or one of them.

flags affecting the operation

mount-operation

Passed, or left out: a <GMountOperation>, or #f.

a <GMountOperation> or #f to avoid user interaction

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied, or #f

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-mount-enclosing-volume-finish implementor self result ⇒ %return

Finishes a mount operation started by file:mount-enclosing-volume.

To override it in a new class, give register-type #:vfuncs `((mount-enclosing-volume-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if successful. If an error has occurred, this function will return #f and set error appropriately if present.

Virtual method: file:do-mount-mountable implementor self flags [mount-operation] [cancellable] [callback]

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 not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

When the operation is finished, callback will be called. You can then call file:mount-mountable-finish to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((mount-mountable . ,procedure)). The procedure is called as (procedure self flags mount-operation cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GMountMountFlags>, or a list of its symbols, or one of them.

flags affecting the operation

mount-operation

Passed, or left out: a <GMountOperation>, or #f.

a <GMountOperation>, or #f to avoid user interaction

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-mount-mountable-finish implementor self result ⇒ %return

Finishes a mount operation. See file:mount-mountable for details.

Finish an asynchronous mount operation that was started with file:mount-mountable.

To override it in a new class, give register-type #:vfuncs `((mount-mountable-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFile>.

a <GFile> or #f on error. Free the returned object with object:unref.

Virtual method: file:do-move implementor self destination flags [cancellable] [progress-callback] ⇒ %return

Tries to move the file or directory self 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 overwrite is specified an already existing destination file is overwritten.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

If progress-callback is not #f, then the operation can be monitored by setting this to a GFileProgressCallback 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 self file does not exist, then the not-found error is returned, independent on the status of the destination.

If overwrite is not specified and the target exists, then the error exists is returned.

If trying to overwrite a file over a directory, the is-directory error is returned. If trying to overwrite a directory with a directory the would-merge error is returned.

If the source is a directory and the target does not exist, or overwrite is specified and the target is a file, then the would-recurse error may be returned (if the native move operation isn’t available).

To override it in a new class, give register-type #:vfuncs `((move . ,procedure)). The procedure is called as (procedure self destination flags cancellable progress-callback progress-callback-data) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

<GFile> pointing to the source location

destination

Passed: a <GFile>.

<GFile> pointing to the destination location

flags

Passed: a <GFileCopyFlags>, or a list of its symbols, or one of them.

set of <GFileCopyFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

progress-callback

Passed, or left out: a procedure, or #f.

GFileProgressCallback function for updates

See GFileProgressCallback for how it is called.

%return

Returned: a boolean.

#t on successful move, #f otherwise.

progress-callback-data

Not passed: guile-gi supplies it.

gpointer to user data for the callback function

Virtual method: file:do-move-async implementor self destination flags io-priority [cancellable] [progress-callback] [callback]

Asynchronously moves a file self to the location of destination. For details of the behaviour, see file:move?.

If progress-callback is not #f, then that function that will be called just like in file:move?. The callback will run in the default main context of the thread calling file:move-async — the same context as callback is run in.

When the operation is finished, callback will be called. You can then call file:move-finish? to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((move-async . ,procedure)). The procedure is called as (procedure self destination flags io-priority cancellable progress-callback progress-callback-data callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

<GFile> pointing to the source location

destination

Passed: a <GFile>.

<GFile> pointing to the destination location

flags

Passed: a <GFileCopyFlags>, or a list of its symbols, or one of them.

set of <GFileCopyFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

progress-callback

Passed, or left out: a procedure, or #f.

GFileProgressCallback function for updates

See GFileProgressCallback for how it is called.

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

progress-callback-data

Not passed: guile-gi supplies it.

gpointer to user data for the callback function

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-move-finish implementor self result ⇒ %return

Finishes an asynchronous file movement, started with file:move-async.

To override it in a new class, give register-type #:vfuncs `((move-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input source <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t on successful file move, #f otherwise.

Virtual method: file:do-open-readwrite implementor self [cancellable] ⇒ %return

Opens an existing file for reading and writing. The result is a <GFileIOStream> that can be used to read and write the contents of the file.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

If the file does not exist, the not-found error will be returned. If the file is a directory, the 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.

To override it in a new class, give register-type #:vfuncs `((open-readwrite . ,procedure)). The procedure is called as (procedure self cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

<GFile> to open

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>

%return

Returned: a <GFileIOStream>.

<GFileIOStream> or #f on error. Free the returned object with object:unref.

Virtual method: file:do-open-readwrite-async implementor self io-priority [cancellable] [callback]

Asynchronously opens self for reading and writing.

For more details, see file:open-readwrite which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:open-readwrite-finish to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((open-readwrite-async . ,procedure)). The procedure is called as (procedure self io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-open-readwrite-finish implementor self res ⇒ %return

Finishes an asynchronous file read operation started with file:open-readwrite-async.

To override it in a new class, give register-type #:vfuncs `((open-readwrite-finish . ,procedure)). The procedure is called as (procedure self res) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileIOStream>.

a <GFileIOStream> or #f on error. Free the returned object with object:unref.

Virtual method: file:do-poll-mountable implementor self [cancellable] [callback]

Polls a file of type mountable.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

When the operation is finished, callback will be called. You can then call file:mount-mountable-finish to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((poll-mountable . ,procedure)). The procedure is called as (procedure self cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied, or #f

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-poll-mountable-finish implementor self result ⇒ %return

Finishes a poll operation. See file:poll-mountable for details.

Finish an asynchronous poll operation that was polled with file:poll-mountable.

To override it in a new class, give register-type #:vfuncs `((poll-mountable-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the operation finished successfully. #f otherwise.

Virtual method: file:do-prefix-matches implementor self file ⇒ %return

Checks whether file has the prefix specified by self.

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

A <GFile> is not a prefix of itself. If you want to check for equality, use file:equal?.

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

To override it in a new class, give register-type #:vfuncs `((prefix-matches . ,procedure)). The procedure is called as (procedure self file) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

file

Passed: a <GFile>.

input <GFile>

%return

Returned: a boolean.

#t if the file’s parent, grandparent, etc is self, #f otherwise.

Virtual method: file:do-query-exists implementor self [cancellable] ⇒ %return

Utility function to check if a particular file exists.

The fallback implementation of this API is using file:query-info and therefore may do blocking I/O. To asynchronously query the existence of a file, use file:query-info-async.

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

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

To override it in a new class, give register-type #:vfuncs `((query-exists . ,procedure)). The procedure is called as (procedure self cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t if the file exists (and can be detected without error), #f otherwise (or if cancelled).

Virtual method: file:do-query-filesystem-info implementor self attributes [cancellable] ⇒ %return

Similar to file:query-info, but obtains information about the filesystem the self is on, rather than the file itself. For instance the amount of space available and the type of the filesystem.

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

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

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

To override it in a new class, give register-type #:vfuncs `((query-filesystem-info . ,procedure)). The procedure is called as (procedure self attributes cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

attributes

Passed: a string.

an attribute query string

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileInfo>.

a <GFileInfo> or #f if there was an error. Free the returned object with object:unref.

Virtual method: file:do-query-filesystem-info-async implementor self attributes io-priority [cancellable] [callback]

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

For more details, see file:query-filesystem-info which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:query-info-finish to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((query-filesystem-info-async . ,procedure)). The procedure is called as (procedure self attributes io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

attributes

Passed: a string.

an attribute query string

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-query-filesystem-info-finish implementor self res ⇒ %return

Finishes an asynchronous filesystem info query. See file:query-filesystem-info-async.

To override it in a new class, give register-type #:vfuncs `((query-filesystem-info-finish . ,procedure)). The procedure is called as (procedure self res) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileInfo>.

<GFileInfo> for given self or #f on error. Free the returned object with object:unref.

Virtual method: file:do-query-info implementor self attributes flags [cancellable] ⇒ %return

Gets the requested information about specified self.

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

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

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

  • Gio.FILE_ATTRIBUTE_STANDARD_NAME
  • Gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME

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

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

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

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

To override it in a new class, give register-type #:vfuncs `((query-info . ,procedure)). The procedure is called as (procedure self attributes flags cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input file

attributes

Passed: a string.

an attribute query string

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

flags to affect the query operation

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional cancellable object

%return

Returned: a <GFileInfo>.

a <GFileInfo> for the given self

Virtual method: file:do-query-info-async implementor self attributes flags io-priority [cancellable] [callback]

Asynchronously gets the requested information about specified self. The result is a <GFileInfo> object that contains key-value attributes (such as type or size for the file).

For more details, see file:query-info which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:query-info-finish to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((query-info-async . ,procedure)). The procedure is called as (procedure self attributes flags io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

attributes

Passed: a string.

an attribute query string

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

a set of <GFileQueryInfoFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-query-info-finish implementor self res ⇒ %return

Finishes an asynchronous file info query. See file:query-info-async.

To override it in a new class, give register-type #:vfuncs `((query-info-finish . ,procedure)). The procedure is called as (procedure self res) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileInfo>.

<GFileInfo> for given self or #f on error. Free the returned object with object:unref.

Virtual method: file:do-query-settable-attributes implementor self [cancellable] ⇒ %return

Obtain the list of settable attributes for the file.

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

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

To override it in a new class, give register-type #:vfuncs `((query-settable-attributes . ,procedure)). The procedure is called as (procedure self cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileAttributeInfoList>.

a <GFileAttributeInfoList> describing the settable attributes. When you are done with it, release it with file-attribute-info-list:unref

Virtual method: file:do-query-writable-namespaces implementor self [cancellable] ⇒ %return

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 not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

To override it in a new class, give register-type #:vfuncs `((query-writable-namespaces . ,procedure)). The procedure is called as (procedure self cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileAttributeInfoList>.

a <GFileAttributeInfoList> describing the writable namespaces. When you are done with it, release it with file-attribute-info-list:unref

Virtual method: file:do-read-async implementor self io-priority [cancellable] [callback]

Asynchronously opens self for reading.

For more details, see file:read which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:read-finish to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((read-async . ,procedure)). The procedure is called as (procedure self io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-read-finish implementor self res ⇒ %return

Finishes an asynchronous file read operation started with file:read-async.

To override it in a new class, give register-type #:vfuncs `((read-finish . ,procedure)). The procedure is called as (procedure self res) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileInputStream>.

a <GFileInputStream> or #f on error. Free the returned object with object:unref.

Virtual method: file:do-read-fn implementor self [cancellable] ⇒ %return

Opens a file for reading. The result is a <GFileInputStream> that can be used to read the contents of the file.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

If the file does not exist, the not-found error will be returned. If the file is a directory, the is-directory error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

To override it in a new class, give register-type #:vfuncs `((read-fn . ,procedure)). The procedure is called as (procedure self cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

<GFile> to read

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>

%return

Returned: a <GFileInputStream>.

<GFileInputStream> or #f on error. Free the returned object with object:unref.

Virtual method: file:do-replace implementor self etag make-backup flags [cancellable] ⇒ %return

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 private in flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

If you pass in a non-#f etag value and self already exists, then this value is compared to the current entity tag of the file, and if they differ an 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 file-output-stream:get-etag after you’ve finished writing and closed the <GFileOutputStream>. When you load a new file you can use file-input-stream:query-info to get the etag of the file.

If make-backup is #t, this function will attempt to make a backup of the current file before overwriting it. If this fails a cant-create-backup error will be returned. If you want to replace anyway, try again with make-backup set to #f.

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

To override it in a new class, give register-type #:vfuncs `((replace . ,procedure)). The procedure is called as (procedure self etag make-backup flags cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

etag

Passed: a string, or #f.

an optional entity tag for the current <GFile>, or NULL to ignore

make-backup

Passed: a boolean.

#t if a backup should be created

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileOutputStream>.

a <GFileOutputStream> or #f on error. Free the returned object with object:unref.

Virtual method: file:do-replace-async implementor self etag make-backup flags io-priority [cancellable] [callback]

Asynchronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first.

For more details, see file:replace which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:replace-finish to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((replace-async . ,procedure)). The procedure is called as (procedure self etag make-backup flags io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

etag

Passed: a string, or #f.

an entity tag for the current <GFile>, or #f to ignore

make-backup

Passed: a boolean.

#t if a backup should be created

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-replace-finish implementor self res ⇒ %return

Finishes an asynchronous file replace operation started with file:replace-async.

To override it in a new class, give register-type #:vfuncs `((replace-finish . ,procedure)). The procedure is called as (procedure self res) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileOutputStream>.

a <GFileOutputStream>, or #f on error. Free the returned object with object:unref.

Virtual method: file:do-replace-readwrite implementor self etag make-backup flags [cancellable] ⇒ %return

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 file:replace which does the same thing but returns an output stream only.

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

To override it in a new class, give register-type #:vfuncs `((replace-readwrite . ,procedure)). The procedure is called as (procedure self etag make-backup flags cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

a <GFile>

etag

Passed: a string, or #f.

an optional entity tag for the current <GFile>, or NULL to ignore

make-backup

Passed: a boolean.

#t if a backup should be created

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFileIOStream>.

a <GFileIOStream> or #f on error. Free the returned object with object:unref.

Virtual method: file:do-replace-readwrite-async implementor self etag make-backup flags io-priority [cancellable] [callback]

Asynchronously overwrites the file in read-write mode, replacing the contents, possibly creating a backup copy of the file first.

For more details, see file:replace-readwrite which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:replace-readwrite-finish to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((replace-readwrite-async . ,procedure)). The procedure is called as (procedure self etag make-backup flags io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

etag

Passed: a string, or #f.

an entity tag for the current <GFile>, or #f to ignore

make-backup

Passed: a boolean.

#t if a backup should be created

flags

Passed: a <GFileCreateFlags>, or a list of its symbols, or one of them.

a set of <GFileCreateFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-replace-readwrite-finish implementor self res ⇒ %return

Finishes an asynchronous file replace operation started with file:replace-readwrite-async.

To override it in a new class, give register-type #:vfuncs `((replace-readwrite-finish . ,procedure)). The procedure is called as (procedure self res) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFileIOStream>.

a <GFileIOStream>, or #f on error. Free the returned object with object:unref.

Virtual method: file:do-resolve-relative-path implementor self relative-path ⇒ %return

Resolves a relative path for self 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 self path as base).

To override it in a new class, give register-type #:vfuncs `((resolve-relative-path . ,procedure)). The procedure is called as (procedure self relative-path) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

relative-path

Passed: a file name, as a string.

a given relative path string

%return

Returned: a <GFile>.

a <GFile> for the resolved path.

Virtual method: file:do-set-attribute implementor self attribute type value-p flags [cancellable] ⇒ %return

Sets an attribute in the file with attribute name attribute to value-p.

Some attributes can be unset by setting type to invalid and value-p to #f.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

To override it in a new class, give register-type #:vfuncs `((set-attribute . ,procedure)). The procedure is called as (procedure self attribute type value-p flags cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

attribute

Passed: a string.

a string containing the attribute’s name

type

Passed: a <GFileAttributeType>, or one of its symbols.

The type of the attribute

value-p

Passed: a foreign pointer, or a bytevector, or #f.

a pointer to the value (or the pointer itself if the type is a pointer type)

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

a set of <GFileQueryInfoFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t if the attribute was set, #f otherwise.

Virtual method: file:do-set-attributes-async implementor self info flags io-priority [cancellable] [callback]

Asynchronously sets the attributes of self with info.

For more details, see file: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 file:set-attributes-finish to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((set-attributes-async . ,procedure)). The procedure is called as (procedure self info flags io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

info

Passed: a <GFileInfo>.

a <GFileInfo>

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

a <GFileQueryInfoFlags>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-set-attributes-finish implementor self result ⇒ %return info

Finishes setting an attribute started in file:set-attributes-async.

To override it in a new class, give register-type #:vfuncs `((set-attributes-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return info.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the attributes were set correctly, #f otherwise.

info

Returned: a <GFileInfo>.

a <GFileInfo>

Virtual method: file:do-set-attributes-from-info implementor self info flags [cancellable] ⇒ %return

Tries to set all attributes in the <GFileInfo> 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 error-setting, which means you can also detect further errors.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

To override it in a new class, give register-type #:vfuncs `((set-attributes-from-info . ,procedure)). The procedure is called as (procedure self info flags cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

info

Passed: a <GFileInfo>.

a <GFileInfo>

flags

Passed: a <GFileQueryInfoFlags>, or a list of its symbols, or one of them.

<GFileQueryInfoFlags>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#f if there was any error, #t otherwise.

Virtual method: file:do-set-display-name implementor self display-name [cancellable] ⇒ %return

Renames self 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 self 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 file:set-display-name.

On success the resulting converted filename is returned.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

To override it in a new class, give register-type #:vfuncs `((set-display-name . ,procedure)). The procedure is called as (procedure self display-name cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

display-name

Passed: a string.

a string

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a <GFile>.

a <GFile> specifying what self was renamed to, or #f if there was an error. Free the returned object with object:unref.

Virtual method: file:do-set-display-name-async implementor self display-name io-priority [cancellable] [callback]

Asynchronously sets the display name for a given <GFile>.

For more details, see file:set-display-name which is the synchronous version of this call.

When the operation is finished, callback will be called. You can then call file:set-display-name-finish to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((set-display-name-async . ,procedure)). The procedure is called as (procedure self display-name io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

display-name

Passed: a string.

a string

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-set-display-name-finish implementor self res ⇒ %return

Finishes setting a display name started with file:set-display-name-async.

To override it in a new class, give register-type #:vfuncs `((set-display-name-finish . ,procedure)). The procedure is called as (procedure self res) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

res

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFile>.

a <GFile> or #f on error. Free the returned object with object:unref.

Virtual method: file:do-start-mountable implementor self flags [start-operation] [cancellable] [callback]

Starts a file of type mountable. Using start-operation, you can request callbacks when, for instance, passwords are needed during authentication.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

When the operation is finished, callback will be called. You can then call file:mount-mountable-finish to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((start-mountable . ,procedure)). The procedure is called as (procedure self flags start-operation cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GDriveStartFlags>, or a list of its symbols, or one of them.

flags affecting the operation

start-operation

Passed, or left out: a <GMountOperation>, or #f.

a <GMountOperation>, or #f to avoid user interaction

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied, or #f

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-start-mountable-finish implementor self result ⇒ %return

Finishes a start operation. See file:start-mountable for details.

Finish an asynchronous start operation that was started with file:start-mountable.

To override it in a new class, give register-type #:vfuncs `((start-mountable-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the operation finished successfully. #f otherwise.

Virtual method: file:do-stop-mountable implementor self flags [mount-operation] [cancellable] [callback]

Stops a file of type mountable.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

When the operation is finished, callback will be called. You can then call file:stop-mountable-finish? to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((stop-mountable . ,procedure)). The procedure is called as (procedure self flags mount-operation cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GMountUnmountFlags>, or a list of its symbols, or one of them.

flags affecting the operation

mount-operation

Passed, or left out: a <GMountOperation>, or #f.

a <GMountOperation>, or #f to avoid user interaction.

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied, or #f

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-stop-mountable-finish implementor self result ⇒ %return

Finishes a stop operation, see file:stop-mountable for details.

Finish an asynchronous stop operation that was started with file:stop-mountable.

To override it in a new class, give register-type #:vfuncs `((stop-mountable-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the operation finished successfully. #f otherwise.

Virtual method: file:do-trash implementor self [cancellable] ⇒ %return

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

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

To override it in a new class, give register-type #:vfuncs `((trash . ,procedure)). The procedure is called as (procedure self cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

<GFile> to send to trash

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

%return

Returned: a boolean.

#t on successful trash, #f otherwise.

Virtual method: file:do-trash-async implementor self io-priority [cancellable] [callback]

Asynchronously sends self to the Trash location, if possible.

To override it in a new class, give register-type #:vfuncs `((trash-async . ,procedure)). The procedure is called as (procedure self io-priority cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-trash-finish implementor self result ⇒ %return

Finishes an asynchronous file trashing operation, started with file:trash-async.

To override it in a new class, give register-type #:vfuncs `((trash-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t on successful trash, #f otherwise.

Virtual method: file:do-unmount-mountable implementor self flags [cancellable] [callback]

Unmounts a file of type G_FILE_TYPE_MOUNTABLE.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

When the operation is finished, callback will be called. You can then call file:unmount-mountable-finish? to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((unmount-mountable . ,procedure)). The procedure is called as (procedure self flags cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GMountUnmountFlags>, or a list of its symbols, or one of them.

flags affecting the operation

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-unmount-mountable-finish implementor self result ⇒ %return

Finishes an unmount operation, see file:unmount-mountable for details.

Finish an asynchronous unmount operation that was started with file:unmount-mountable.

To override it in a new class, give register-type #:vfuncs `((unmount-mountable-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the operation finished successfully. #f otherwise.

Virtual method: file:do-unmount-mountable-with-operation implementor self flags [mount-operation] [cancellable] [callback]

Unmounts a file of type mountable.

If cancellable is not #f, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error cancelled will be returned.

When the operation is finished, callback will be called. You can then call file:unmount-mountable-finish? to get the result of the operation.

To override it in a new class, give register-type #:vfuncs `((unmount-mountable-with-operation . ,procedure)). The procedure is called as (procedure self flags mount-operation cancellable callback user-data).

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

flags

Passed: a <GMountUnmountFlags>, or a list of its symbols, or one of them.

flags affecting the operation

mount-operation

Passed, or left out: a <GMountOperation>, or #f.

a <GMountOperation>, or #f to avoid user interaction

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: file:do-unmount-mountable-with-operation-finish implementor self result ⇒ %return

Finishes an unmount operation, see file:unmount-mountable-with-operation for details.

Finish an asynchronous unmount operation that was started with file:unmount-mountable-with-operation.

To override it in a new class, give register-type #:vfuncs `((unmount-mountable-with-operation-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GFile>, or its GType number.

self

Passed: a <GFile>.

input <GFile>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

#t if the operation finished successfully. #f otherwise.