make sure the parent directory exists

This commit is contained in:
Aster 2023-03-27 13:39:34 +08:00
parent 743abbed28
commit b23e1864c4

View File

@ -232,6 +232,10 @@ impl Builder {
}
fn make_file<P: AsRef<Path>>(path: P) -> io::Result<File> {
let path = path.as_ref();
if let Some(parent) = path.parent() {
std::fs::create_dir_all(parent)?;
}
let file = OpenOptions::new()
.write(true)
.truncate(true)