Like [`resolve_path`], but when `path` is `None` it walks up from `cwd` to find the nearest initialised `TraceDecay` project before falling back to `cwd` itself. Used by `serve`, `sync`, and `status`. NOT used by `init` (which must create a fresh project at the target directory).
(path: Option<String>)
| 703 | /// Used by `serve`, `sync`, and `status`. NOT used by `init` (which must |
| 704 | /// create a fresh project at the target directory). |
| 705 | pub fn resolve_path_with_discovery(path: Option<String>) -> PathBuf { |
| 706 | if let Some(p) = path { |
| 707 | PathBuf::from(p) |
| 708 | } else { |
| 709 | let cwd = std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")); |
| 710 | discover_project_root(&cwd) |
| 711 | .or_else(|| crate::worktree::git_worktree_root(&cwd)) |
| 712 | .unwrap_or(cwd) |
| 713 | } |
| 714 | } |
| 715 | |
| 716 | fn paths_same(left: &Path, right: &Path) -> bool { |
| 717 | let left = std::fs::canonicalize(left).unwrap_or_else(|_| left.to_path_buf()); |
no test coverage detected