Vfs#
Superclasses: Object
Entry point for using GIO functionality.
Methods#
- class Vfs
-
- get_file_for_path(path: str) File #
Gets a
File
forpath
.- Parameters:
path – a string containing a VFS path.
- get_file_for_uri(uri: str) File #
Gets a
File
foruri
.This operation never fails, but the returned object might not support any I/O operation if the URI is malformed or if the URI scheme is not supported.
- Parameters:
uri – a string containing a URI
- parse_name(parse_name: str) File #
This operation never fails, but the returned object might not support any I/O operations if the
parse_name
cannot be parsed by theVfs
module.- Parameters:
parse_name – a string to be parsed by the VFS module.
- register_uri_scheme(scheme: str, uri_func: Callable[[...], File] | None = None, parse_name_func: Callable[[...], File] | None = None, *parse_name_data: Any) bool #
Registers
uri_func
andparse_name_func
as theFile
URI and parse name lookup functions for URIs with a scheme matchingscheme
. Note thatscheme
is registered only within the running application, as opposed to desktop-wide as it happens with GVfs backends.When a
File
is requested with an URI containingscheme
(e.g. throughnew_for_uri()
),uri_func
will be called to allow a custom constructor. The implementation ofuri_func
should not be blocking, and must not callregister_uri_scheme()
orunregister_uri_scheme()
.When
parse_name()
is called with a parse name obtained from such file,parse_name_func
will be called to allow theFile
to be created again. In that case, it’s responsibility ofparse_name_func
to make sure the parse name matches what the customFile
implementation returned whenget_parse_name()
was previously called. The implementation ofparse_name_func
should not be blocking, and must not callregister_uri_scheme()
orunregister_uri_scheme()
.It’s an error to call this function twice with the same scheme. To unregister a custom URI scheme, use
unregister_uri_scheme()
.Added in version 2.50.
- Parameters:
scheme – an URI scheme, e.g. “http”
uri_func – a
VfsFileLookupFunc
parse_name_func – a
VfsFileLookupFunc
parse_name_data – custom data passed to be passed to
parse_name_func
, orNone
- unregister_uri_scheme(scheme: str) bool #
Unregisters the URI handler for
scheme
previously registered withregister_uri_scheme()
.Added in version 2.50.
- Parameters:
scheme – an URI scheme, e.g. “http”
Virtual Methods#
- class Vfs
- do_add_writable_namespaces(list: FileAttributeInfoList) None #
The type of the None singleton.
- Parameters:
list
- do_get_file_for_path(path: str) File #
Gets a
File
forpath
.- Parameters:
path – a string containing a VFS path.
- do_get_file_for_uri(uri: str) File #
Gets a
File
foruri
.This operation never fails, but the returned object might not support any I/O operation if the URI is malformed or if the URI scheme is not supported.
- Parameters:
uri – a string containing a URI
- do_local_file_add_info(filename: str, device: int, attribute_matcher: FileAttributeMatcher, info: FileInfo, cancellable: Cancellable | None, extra_data: None, free_extra_data: Callable[[None], None]) None #
The type of the None singleton.
- Parameters:
filename
device
attribute_matcher
info
cancellable
extra_data
free_extra_data
- do_local_file_moved(source: str, dest: str) None #
The type of the None singleton.
- Parameters:
source
dest
- do_local_file_set_attributes(filename: str, info: FileInfo, flags: FileQueryInfoFlags, cancellable: Cancellable | None = None) bool #
The type of the None singleton.
- Parameters:
filename
info
flags
cancellable
Fields#
- class Vfs
- parent_instance#