Skip to main content

find_project_root

Function find_project_root 

Source
pub fn find_project_root(start: &Path) -> Option<PathBuf>
Expand description

Find the project root by walking up the directory tree.

Searches for a Largo.toml file starting from start and moving up through parent directories. Returns the directory containing the manifest, or None if no manifest is found.

§Arguments

  • start - Starting path (can be a file or directory)

§Example

use std::path::Path;
use logicaffeine_cli::project::build::find_project_root;

// Find project root from a subdirectory
let root = find_project_root(Path::new("/projects/myapp/src/lib.lg"));
assert_eq!(root, Some("/projects/myapp".into()));