restore: Don't abort on delete errors

This commit is contained in:
Alexander Weiss 2023-01-20 06:54:46 +01:00
parent b80a8dcb5f
commit 808e495ec2

View File

@ -189,16 +189,21 @@ fn allocate_and_collect(
let path = entry.path();
match &removed_dir {
Some(dir) if path.starts_with(dir) => {}
_ => {
dest.remove_dir(path)
.with_context(|| format!("error removing {path:?}"))?;
removed_dir = Some(path.to_path_buf());
}
_ => match dest.remove_dir(path) {
Ok(()) => {
removed_dir = Some(path.to_path_buf());
}
Err(err) => {
error!("error removing {path:?}: {err}");
}
},
}
}
(true, false, false) => {
if let Err(err) = dest.remove_file(entry.path()) {
error!("error removing {:?}: {err}", entry.path());
}
}
(true, false, false) => dest
.remove_file(entry.path())
.with_context(|| format!("error removing {:?}", entry.path()))?,
(false, _, _) => {
additional_existing = true;
}