Create cache directory prior to writing .gitignore

This commit is contained in:
Charlie Marsh 2022-09-16 04:56:58 -04:00
parent 06e5b3e457
commit 24de97d951
1 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,5 @@
use std::collections::hash_map::DefaultHasher;
use std::fs::{File, Metadata};
use std::fs::{create_dir_all, File, Metadata};
use std::hash::{Hash, Hasher};
use std::io::Write;
use std::path::Path;
@ -90,6 +90,7 @@ pub fn init() -> Result<()> {
if gitignore_path.exists() {
return Ok(());
}
create_dir_all(cache_dir())?;
let mut file = File::create(gitignore_path)?;
file.write_all(b"*").map_err(|e| e.into())
}