You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
396 B
Rust
15 lines
396 B
Rust
use std::path::Path;
|
|
|
|
pub fn ensure_directory_exists(file: &Path) -> Result<(), std::io::Error> {
|
|
if let Some(path) = file.parent() {
|
|
if !path.exists() {
|
|
tracing::info!(
|
|
"Parent directory does not exist, creating recursively: {}",
|
|
file.display()
|
|
);
|
|
return std::fs::create_dir_all(path);
|
|
}
|
|
}
|
|
Ok(())
|
|
}
|