canic_testkit/artifacts/workspace.rs
1use std::path::{Path, PathBuf};
2
3/// Resolve the workspace root from a crate manifest directory.
4#[must_use]
5pub fn workspace_root_for(crate_manifest_dir: &str) -> PathBuf {
6 PathBuf::from(crate_manifest_dir)
7 .parent()
8 .and_then(|path| path.parent())
9 .map(PathBuf::from)
10 .expect("workspace root")
11}
12
13/// Return a stable target directory for host-side wasm test artifacts.
14#[must_use]
15pub fn test_target_dir(workspace_root: &Path, name: &str) -> PathBuf {
16 workspace_root.join("target").join(name)
17}