Function nu_parser::find_in_dirs
source · pub fn find_in_dirs(
filename: &str,
working_set: &StateWorkingSet<'_>,
cwd: &str,
dirs_var_name: &str
) -> Option<ParserPath>
Expand description
This helper function is used to find files during parsing
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, dirs_var is checked.
For now, we first check for a const with the name of dirs_var_name
,
and if that’s not found, then we try to look for an environment variable of the same name.
If there is a relative path in dirs_var, it is assumed to be relative to the actual cwd
determined in the first step.
Always returns an absolute path