ignore error when directory creation fails with AlreadyExists

This commit is contained in:
Mark 2023-09-13 15:27:04 +02:00
parent df15ef85bd
commit 90f0a8ded4

View File

@ -33,7 +33,13 @@ pub fn apply_indexchanges_int(
match change { match change {
IndexChange::AddDir(dir) => { IndexChange::AddDir(dir) => {
let t = target.join(dir); let t = target.join(dir);
if let Err(e) = fs::create_dir(&t) { if let Some(e) = fs::create_dir(&t).err().and_then(|e| {
if matches!(e.kind(), io::ErrorKind::AlreadyExists) {
None
} else {
Some(e)
}
}) {
eprintln!("\n[warn] couldn't create directory {t:?}: {e}"); eprintln!("\n[warn] couldn't create directory {t:?}: {e}");
} else { } else {
fs::create_dir(&index.join(dir))?; fs::create_dir(&index.join(dir))?;