From 450bb482e83c934e67fd5e8f515f240d957f0e31 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 28 Feb 2019 07:42:28 +0100 Subject: o Emptying the directory before trying to remove it. --- src/ee/part/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ee/part') diff --git a/src/ee/part/__init__.py b/src/ee/part/__init__.py index e0b0087..cf60dd5 100644 --- a/src/ee/part/__init__.py +++ b/src/ee/part/__init__.py @@ -83,6 +83,10 @@ def save_db(dir_path: Path, db: PartDb): if not idx_path.is_file(): raise EeException("The given db directory exists, but does not look like a part db dir") + for p in dir_path.iterdir(): + if not p.is_file(): + raise EeException("Non-file: {}".format(p)) + p.unlink() dir_path.rmdir() dir_path.mkdir(parents=True, exist_ok=True) -- cgit v1.2.3