glib

Function filename_from_uri

Source
pub fn filename_from_uri(uri: &str) -> Result<(PathBuf, Option<GString>), Error>
Expand description

Converts an escaped ASCII-encoded URI to a local filename in the encoding used for filenames.

Since GLib 2.78, the query string and fragment can be present in the URI, but are not part of the resulting filename. We take inspiration from https://url.spec.whatwg.org/#file-state, but we don’t support the entire standard.

§uri

a uri describing a filename (escaped, encoded in ASCII).

§Returns

a newly-allocated string holding the resulting filename, or None on an error.

§hostname

Location to store hostname for the URI. If there is no hostname in the URI, None will be stored in this location.