Deal with the node being a bad link
This commit is contained in:
parent
b2929290c0
commit
cff7c8d5e7
1 changed files with 7 additions and 3 deletions
|
@ -51,12 +51,16 @@ class Vfs(object):
|
|||
|
||||
elif e[0] == "unlink":
|
||||
_, dest = e
|
||||
if dest.is_symlink():
|
||||
# Note that a path which is a dangling symlink will NOT exist but WILL be a symlink
|
||||
if not dest.exists() and not dest.is_symlink():
|
||||
return
|
||||
# Files and dirs just unlink
|
||||
if dest.is_symlink() or dest.is_file():
|
||||
dest.unlink()
|
||||
# Dirs require recursion
|
||||
elif dest.is_dir():
|
||||
rmtree(dest)
|
||||
elif dest.is_file():
|
||||
dest.unlink()
|
||||
# Don't succeed silently
|
||||
else:
|
||||
raise Exception(f"Couldn't unlink {dest}")
|
||||
|
||||
|
|
Loading…
Reference in a new issue