shipd_core/project.rs
1use std::path::{Path, PathBuf};
2
3pub fn find_project_root(start: &Path) -> Option<PathBuf> {
4 let mut current = start.to_path_buf();
5
6 loop {
7 let marker = current.join(".shipd");
8 if marker.exists() {
9 return Some(current);
10 }
11
12 if !current.pop() {
13 return None;
14 }
15 }
16}
17
18pub fn read_project_id(project_root: &Path) -> Option<i64> {
19 let marker = project_root.join(".shipd");
20 let content = std::fs::read_to_string(marker).ok()?;
21 content.trim().parse().ok()
22}