mkdir_all

This commit is contained in:
2025-11-17 21:25:33 -05:00
parent 46a1b2279e
commit 930a140791

View File

@@ -38,7 +38,9 @@ impl DataDir {
} }
pub fn save<T: bincode::Encode>(&self, path: &str, data: &T) { pub fn save<T: bincode::Encode>(&self, path: &str, data: &T) {
let mut file = File::create(self.get().join(path)).unwrap(); let dir = self.get();
fs::create_dir_all(dir).unwrap();
let mut file = File::create(dir.join(path)).unwrap();
bincode::encode_into_std_write(data, &mut file, BINCODE_CONFIG).unwrap(); bincode::encode_into_std_write(data, &mut file, BINCODE_CONFIG).unwrap();
} }
} }