Skip to main content

find_project_root

Function find_project_root 

Source
pub fn find_project_root() -> Option<PathBuf>
Expand description

Find the project root by searching for theme.dampen in multiple locations.

This function implements a robust search strategy for finding the project root when the application is run from various locations (e.g., target/release).

Search order:

  1. CARGO_MANIFEST_DIR environment variable (available during cargo run)
  2. Ancestors of the executable location (for binaries in target/release)
  3. Workspace examples directory (for examples in a workspace)
  4. Ancestors of the current working directory

ยงReturns

The project root path if found, None otherwise