Skip to main content

normalize_to_root

Function normalize_to_root 

Source
pub fn normalize_to_root(path: &Path) -> Option<PathBuf>
Expand description

Find the project root for path by walking up until a marker is found.

  • If path itself is a directory containing a marker, it is its own root.
  • Otherwise we walk up ancestors looking for the first directory that contains a marker.
  • Returns None if no marker is found within the filesystem (e.g. the path doesn’t exist, or it’s a loose file with no project context).