Rename the previous version of the database instead of copying it, since we're about to overwrite it anyway.
This commit is contained in:
parent
0bae05342f
commit
6241d71f47
1 changed files with 1 additions and 1 deletions
|
@ -50,7 +50,7 @@ impl ResourceList {
|
|||
pub fn save(&self, path: impl AsRef<Path> + Debug) -> Result<(), ResourceSaveError> {
|
||||
info!("Creating backup before writing...");
|
||||
let path = path.as_ref();
|
||||
std::fs::copy(path, path.with_extension("bak")).map_err(ResourceSaveError::BackupFailed)?;
|
||||
std::fs::rename(path, path.with_extension("bak")).map_err(ResourceSaveError::BackupFailed)?;
|
||||
info!("Writing data to {path:?}...");
|
||||
let file = std::fs::File::create(path).map_err(ResourceSaveError::FileOpen)?;
|
||||
self.save_to_writer(file)
|
||||
|
|
Loading…
Reference in a new issue