mkdir_all
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user