get_uri_scheme


Description:

public abstract string? get_uri_scheme ()

Gets the URI scheme for a File.

RFC 3986 decodes the scheme as:

URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
Common schemes include "file", "http", "ftp", etc.

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

This call does no blocking I/O.

Example: Get the URI scheme:

public static int main (string[] args) {
// Output: ``file``
File file = File.new_for_path ("../my/dir/my-test.txt");
string parse_name = file.get_uri_scheme ();
print ("%s\n", parse_name);
return 0;
}

valac --pkg gio-2.0 GLib.File.get_uri_scheme.vala

Parameters:

this

input File

Returns:

a string containing the URI scheme for the given File or null if the File was constructed with an invalid URI. The returned string should be freed with g_free when no longer needed.