More cases of neading to clean during execution

This commit is contained in:
Reid 'arrdem' McKenzie 2022-07-28 19:25:30 -06:00
parent e39df4d663
commit 0cfedb398a

View file

@ -32,11 +32,14 @@ class Vfs(object):
if dest.is_symlink() and dest.readlink() == src:
continue
else:
_log.warn(f"Replacing {dest}")
dest.unlink()
elif dest.is_dir():
_log.warn(f"Replacing {dest}")
rmtree(dest)
assert not dest.exists()
assert not dest.exists(), f"{dest} should not exist"
dest.symlink_to(src)
assert dest.exists()
elif e[0] == "copy":
raise NotImplementedError()
@ -47,6 +50,11 @@ class Vfs(object):
elif e[0] == "mkdir":
_, dest = e
if dest.is_dir():
continue
elif dest.exists() or dest.is_symlink():
dest.unlink()
dest.mkdir(exist_ok=True)
elif e[0] == "unlink":