exists() is the wrong predicate; false-negatives on broken links
This commit is contained in:
parent
0503dc2df7
commit
5d471ec395
1 changed files with 7 additions and 5 deletions
|
@ -28,11 +28,13 @@ class Vfs(object):
|
||||||
|
|
||||||
elif e[0] == "link":
|
elif e[0] == "link":
|
||||||
_, src, dest = e
|
_, src, dest = e
|
||||||
if dest.exists() and dest.is_symlink() and dest.readlink() == dest:
|
if dest.is_file() or dest.is_symlink():
|
||||||
|
if dest.is_symlink() and dest.readlink() == src:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
if dest.exists():
|
|
||||||
dest.unlink()
|
dest.unlink()
|
||||||
|
|
||||||
|
assert not dest.exists()
|
||||||
dest.symlink_to(src)
|
dest.symlink_to(src)
|
||||||
|
|
||||||
elif e[0] == "copy":
|
elif e[0] == "copy":
|
||||||
|
|
Loading…
Reference in a new issue