pub fn find_project_root(start: &Path, home: Option<&Path>) -> Option<PathBuf>Expand description
Walk upward from start looking for project marker files.
home is an optional ceiling. When the walk reaches home, it stops before
testing that directory for markers. This avoids accidental matches from
marker files stored directly in a user’s home directory. On Windows the
ceiling comparison ignores ASCII case, matching the file system.
At most MAX_WALK_DEPTH directories are tested, starting with start.
A relative start is walked lexically and ends at the current directory,
so src tests src and then ., and a hit there is returned as ..
§Examples
use std::path::Path;
use what_stack::find_project_root;
assert_eq!(find_project_root(Path::new("."), Some(Path::new("."))), None);