SolarEnergy/central_backend/src/utils/files_utils.rs

11 lines
251 B
Rust
Raw Normal View History

2024-06-27 16:55:09 +00:00
use std::path::Path;
/// Create directory if missing
pub fn create_directory_if_missing<P: AsRef<Path>>(path: P) -> anyhow::Result<()> {
let path = path.as_ref();
if !path.exists() {
std::fs::create_dir_all(path)?;
}
Ok(())
2024-06-27 23:05:02 +00:00
}