From 27329865ee44b6f3d75e19de078bef0706ef396d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 26 Oct 2024 10:57:20 +0200 Subject: [PATCH] fs/wipe --- rwx/fs/__init__.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rwx/fs/__init__.py b/rwx/fs/__init__.py index 205746d..0772a8d 100644 --- a/rwx/fs/__init__.py +++ b/rwx/fs/__init__.py @@ -139,11 +139,9 @@ def wipe(path: Path) -> None: :type path: Path """ try: - shutil.rmtree(path) - except NotADirectoryError: path.unlink(missing_ok=True) - except FileNotFoundError: - pass + except IsADirectoryError: + shutil.rmtree(path) def write(file_path: Path, text: str, charset: str = CHARSET) -> None: