allow index symlinks to change

This commit is contained in:
Mark 2025-06-06 00:34:42 +02:00
parent a742bffddc
commit 5ac3d9aee0

View File

@ -203,12 +203,12 @@ pub fn apply_indexchanges_int(
if let Err(e) = std::env::set_current_dir(&p) { if let Err(e) = std::env::set_current_dir(&p) {
eprintln!("\n[warn] couldn't cd to {p:?}: {e}"); eprintln!("\n[warn] couldn't cd to {p:?}: {e}");
} else { } else {
if let Err(e) = std::os::unix::fs::symlink( let index_file_name = index_file
link_target, .file_name()
index_file .expect("a file should always have a filename");
.file_name() let _ = std::fs::remove_file(&index_file_name);
.expect("a file should always have a filename"), if let Err(e) = std::os::unix::fs::symlink(link_target, index_file_name)
) { {
eprintln!( eprintln!(
"\n[warn] couldn't set index file {index_file:?} to be a symlink to {link_target:?}: {e}" "\n[warn] couldn't set index file {index_file:?} to be a symlink to {link_target:?}: {e}"
); );