rtic/xtask/src/build.rs

14 lines
501 B
Rust
Raw Normal View History

2021-12-26 10:43:57 +01:00
use std::{fs, path::Path};
2021-08-26 10:58:59 +02:00
2021-09-20 17:35:15 +02:00
const HEX_BUILD_ROOT: &str = "ci/builds";
/// make sure we're starting with a clean,but existing slate
pub fn init_build_dir() -> anyhow::Result<()> {
if Path::new(HEX_BUILD_ROOT).exists() {
fs::remove_dir_all(HEX_BUILD_ROOT)
.map_err(|_| anyhow::anyhow!("Could not clear out directory: {}", HEX_BUILD_ROOT))?;
}
fs::create_dir_all(HEX_BUILD_ROOT)
.map_err(|_| anyhow::anyhow!("Could not create directory: {}", HEX_BUILD_ROOT))
}