#[cfg(feature = "beta-vm")]
fn devshell_repo_root_walk(mut dir: std::path::PathBuf) -> Option<std::path::PathBuf> {
loop {
let cf = dir.join("containers/devshell-vm/Containerfile");
if cf.is_file() {
return Some(dir);
}
if !dir.pop() {
break;
}
}
None
}
#[cfg_attr(not(windows), allow(dead_code))]
#[cfg(feature = "beta-vm")]
pub fn devshell_repo_root_with_containerfile() -> Option<std::path::PathBuf> {
let dir = std::env::current_dir().ok()?;
devshell_repo_root_walk(dir)
}
#[cfg_attr(not(windows), allow(dead_code))]
#[cfg(feature = "beta-vm")]
pub fn devshell_repo_root_from_path(start: &std::path::Path) -> Option<std::path::PathBuf> {
devshell_repo_root_walk(start.to_path_buf())
}