ic_testkit/artifacts/
workspace.rs1use std::path::{Path, PathBuf};
2
3#[must_use]
5pub fn workspace_root_for(crate_manifest_dir: &str) -> PathBuf {
6 let manifest_dir = PathBuf::from(crate_manifest_dir);
7 if manifest_dir.parent().and_then(Path::file_name) == Some(std::ffi::OsStr::new("crates")) {
8 return manifest_dir
9 .parent()
10 .and_then(Path::parent)
11 .map(PathBuf::from)
12 .expect("workspace root");
13 }
14
15 manifest_dir
16}
17
18#[must_use]
20pub fn test_target_dir(workspace_root: &Path, name: &str) -> PathBuf {
21 workspace_root.join("target").join(name)
22}