Add cleanup dead symlink

This commit is contained in:
Yusuke Kadowaki 2022-10-27 01:16:43 +09:00
parent 58ddc6d754
commit ebf8761cb7
1 changed files with 6 additions and 0 deletions

View File

@ -346,6 +346,12 @@ def cleanup_numbered_dir(
for path in root.glob("garbage-*"):
try_cleanup(path, consider_lock_dead_if_created_before)
# remove dead symlink
for left_dir in root.iterdir():
if left_dir.is_symlink():
if not left_dir.resolve().exists():
left_dir.unlink()
def make_numbered_dir_with_cleanup(
root: Path,