Skip to main content

find_tool_root

Function find_tool_root 

Source
pub fn find_tool_root(
    anchor_bin: &str,
    preferred_sibling: Option<&str>,
    sibling_marker: Option<&str>,
    walk_up: usize,
) -> Option<PathBuf>
Expand description

Resolve a tool like dotnet to its installation root. Canonicalizes anchor_bin from $PATH (following Homebrew-style shims), walks up to walk_up levels looking for a preferred_sibling directory, and falls back to the directory that directly contains the anchor binary.

If sibling_marker is Some, only preferred_sibling directories that contain the given relative path (e.g. "shared") are accepted — used to gate on a shape-specific file that proves this is the right root, not just a directory that happens to be named the same.