mkdir_all
This commit is contained in:
1 parent
46a1b2279e
commit
930a140791
1 file changed
+3
-1
+3
-1
@@ -38,7 +38,9 @@ impl DataDir {
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user