tugger_common/
testutil.rs1use {once_cell::sync::Lazy, std::path::PathBuf};
6
7pub static DEFAULT_TEMP_DIR: Lazy<tempfile::TempDir> = Lazy::new(|| {
8 tempfile::Builder::new()
9 .prefix("tugger-test")
10 .tempdir()
11 .expect("unable to create temporary directory")
12});
13
14pub static DEFAULT_DOWNLOAD_DIR: Lazy<PathBuf> = Lazy::new(|| {
15 let p = if let Ok(manifest_dir) = std::env::var("OUT_DIR") {
16 PathBuf::from(manifest_dir).join("tugger-files")
17 } else {
18 DEFAULT_TEMP_DIR.path().join("tugger-files")
19 };
20
21 std::fs::create_dir_all(&p).expect("unable to create download directory");
22
23 p
24});