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";
|
|
|
|
|
2023-02-04 15:22:43 +01:00
|
|
|
/// Make sure we're starting with a clean, but existing slate
|
2021-09-20 17:35:15 +02:00
|
|
|
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))
|
|
|
|
}
|