1
0
Fork 0

simplified read-only handling again

This commit is contained in:
Christian Kühnel 2020-04-16 13:54:50 +02:00
parent 620945da3c
commit bf0fb3fc68

View file

@ -154,17 +154,8 @@ def secure_delete(path: str):
return
def del_rw(action, name, exc):
if not os.path.exists(name):
return
for root, dirs, files in os.walk(name, topdown=False):
for name in files:
p = Path(os.path.join(root, name))
p.chmod(stat.S_IWRITE)
if os.path.isdir(name):
shutil.rmtree(name)
else:
os.unlink(name)
os.chmod(name, stat.S_IWRITE)
os.unlink(name)
shutil.rmtree(path, onerror=del_rw)