fs/wipe
All checks were successful
/ job (push) Successful in 1m10s

This commit is contained in:
Marc Beninca 2024-10-26 10:57:20 +02:00
parent 0ae7d01a1e
commit 27329865ee
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -139,11 +139,9 @@ def wipe(path: Path) -> None:
:type path: Path :type path: Path
""" """
try: try:
shutil.rmtree(path)
except NotADirectoryError:
path.unlink(missing_ok=True) path.unlink(missing_ok=True)
except FileNotFoundError: except IsADirectoryError:
pass shutil.rmtree(path)
def write(file_path: Path, text: str, charset: str = CHARSET) -> None: def write(file_path: Path, text: str, charset: str = CHARSET) -> None: