Be better at removing dead links

This commit is contained in:
Reid 'arrdem' McKenzie 2022-07-27 23:04:25 -06:00
commit 1df60b873b
2 changed files with 8 additions and 2 deletions
projects/vfs/src/python/vfs

View file

@ -51,10 +51,14 @@ class Vfs(object):
elif e[0] == "unlink":
_, dest = e
if dest.is_dir():
if dest.is_symlink():
dest.unlink()
elif dest.is_dir():
rmtree(dest)
elif dest.is_file():
dest.unlink()
else:
raise Exception(f"Couldn't unlink {dest}")
def _append(self, msg):
self._log.append(msg)