From 620945da3cd2c404fac44e9036777f9f5291c7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=BChnel?= Date: Thu, 16 Apr 2020 13:52:08 +0200 Subject: [PATCH] separate handling of single files --- scripts/run_cmake.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/run_cmake.py b/scripts/run_cmake.py index 61bd5fb..5ca36cc 100755 --- a/scripts/run_cmake.py +++ b/scripts/run_cmake.py @@ -159,10 +159,12 @@ def secure_delete(path: str): for root, dirs, files in os.walk(name, topdown=False): for name in files: - p = Path (os.path.join(root, name)) + p = Path(os.path.join(root, name)) p.chmod(stat.S_IWRITE) - - shutil.rmtree(name) + if os.path.isdir(name): + shutil.rmtree(name) + else: + os.unlink(name) shutil.rmtree(path, onerror=del_rw)