Use rmdir if necessary

This commit is contained in:
Jakob Moser 2025-05-24 19:39:00 +02:00
parent ddc1448acc
commit da023a5ae2
Signed by: jakob
GPG Key ID: 3EF2BA2851B3F53C

View File

@ -13,4 +13,7 @@ class DeleteInstruction(Instruction):
path_to_delete: Path
def __call__(self) -> None:
self.path_to_delete.unlink()
try:
self.path_to_delete.unlink()
except IsADirectoryError:
self.path_to_delete.rmdir()