Vfs.registerUriScheme

Registers uri_func and parse_name_func as the #GFile URI and parse name lookup functions for URIs with a scheme matching scheme. Note that scheme is registered only within the running application, as opposed to desktop-wide as it happens with GVfs backends.

When a #GFile is requested with an URI containing scheme (e.g. through gio.file.File.newForUri), uri_func will be called to allow a custom constructor. The implementation of uri_func should not be blocking, and must not call gio.vfs.Vfs.registerUriScheme or gio.vfs.Vfs.unregisterUriScheme.

When gio.file.File.parseName is called with a parse name obtained from such file, parse_name_func will be called to allow the #GFile to be created again. In that case, it's responsibility of parse_name_func to make sure the parse name matches what the custom #GFile implementation returned when gio.file.File.getParseName was previously called. The implementation of parse_name_func should not be blocking, and must not call gio.vfs.Vfs.registerUriScheme or gio.vfs.Vfs.unregisterUriScheme.

It's an error to call this function twice with the same scheme. To unregister a custom URI scheme, use gio.vfs.Vfs.unregisterUriScheme.

class Vfs
bool
registerUriScheme

Parameters

scheme string

an URI scheme, e.g. "http"

uriFunc gio.types.VfsFileLookupFunc

a #GVfsFileLookupFunc

parseNameFunc gio.types.VfsFileLookupFunc

a #GVfsFileLookupFunc

Return Value

Type: bool

true if scheme was successfully registered, or false if a handler for scheme already exists.