nu_engine::env

Function find_in_dirs_env

Source
pub fn find_in_dirs_env(
    filename: &str,
    engine_state: &EngineState,
    stack: &Stack,
    dirs_var: Option<VarId>,
) -> Result<Option<PathBuf>, ShellError>
Expand description

This helper function is used to find files during eval

First, the actual current working directory is selected as a) the directory of a file currently being parsed b) current working directory (PWD)

Then, if the file is not found in the actual cwd, NU_LIB_DIRS is checked. If there is a relative path in NU_LIB_DIRS, it is assumed to be relative to the actual cwd determined in the first step.

Always returns an absolute path