MCPcopy Create free account
hub / github.com/csskit/csskit / find_workspace_root

Function find_workspace_root

crates/csskit_spec_generator/src/fetch_cached.rs:51–57  ·  view source on GitHub ↗

Finds the workspace root by searching for Cargo.toml upward from the current directory

()

Source from the content-addressed store, hash-verified

49
50/// Finds the workspace root by searching for Cargo.toml upward from the current directory
51fn find_workspace_root() -> Result<PathBuf> {
52 let mut dir = current_dir()?;
53 while !dir.join("Cargo.toml").exists() {
54 dir = dir.parent().ok_or_else(|| anyhow!("Could not find workspace"))?.to_path_buf();
55 }
56 Ok(dir)
57}
58
59/// Fetches content from a URL, using cached content if it's fresh enough
60///

Callers 1

workspace_target_cacheFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected