canic_testkit/artifacts/
workspace.rs1use std::{
2 env,
3 path::{Path, PathBuf},
4};
5
6#[must_use]
8pub fn workspace_root_for(crate_manifest_dir: &str) -> PathBuf {
9 PathBuf::from(crate_manifest_dir)
10 .parent()
11 .and_then(|path| path.parent())
12 .map(PathBuf::from)
13 .expect("workspace root")
14}
15
16#[must_use]
18pub fn prebuilt_wasm_dir(env_var: &str) -> Option<PathBuf> {
19 env::var(env_var).ok().map(PathBuf::from)
20}
21
22#[must_use]
24pub fn test_target_dir(workspace_root: &Path, name: &str) -> PathBuf {
25 workspace_root.join("target").join(name)
26}