Function git_path::realpath_opts

source ·
pub fn realpath_opts(
    path: impl AsRef<Path>,
    cwd: impl AsRef<Path>,
    max_symlinks: u8
) -> Result<PathBuf, Error>
Expand description

The same as realpath(), but allow to configure max_symlinks to configure how many symbolic links we are going to follow. This serves to avoid running into cycles or doing unreasonable amounts of work.

Examples found in repository?
src/realpath.rs (line 40)
33
34
35
36
37
38
39
40
41
    pub fn realpath(path: impl AsRef<Path>) -> Result<PathBuf, Error> {
        let cwd = path
            .as_ref()
            .is_relative()
            .then(std::env::current_dir)
            .unwrap_or_else(|| Ok(PathBuf::default()))
            .map_err(Error::CurrentWorkingDir)?;
        realpath_opts(path, cwd, MAX_SYMLINKS)
    }