Function glib::functions::canonicalize_filename[][src]

pub fn canonicalize_filename<P: AsRef<Path>, Q: AsRef<Path>>(
    filename: P,
    relative_to: Q
) -> PathBuf
This is supported on crate feature v2_58 only.
Expand description

Gets the canonical file name from filename. All triple slashes are turned into single slashes, and all .. and .s resolved against relative_to.

Symlinks are not followed, and the returned path is guaranteed to be absolute.

If filename is an absolute path, relative_to is ignored. Otherwise, relative_to will be prepended to filename to make it absolute. relative_to must be an absolute path, or None. If relative_to is None, it’ll fallback to g_get_current_dir().

This function never fails, and will canonicalize file paths even if they don’t exist.

No file system I/O is done.

filename

the name of the file

relative_to

the relative directory, or None to use the current working directory

Returns

a newly allocated string with the canonical file path