diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2019-02-28 07:42:28 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2019-02-28 07:42:28 +0100 |
commit | 450bb482e83c934e67fd5e8f515f240d957f0e31 (patch) | |
tree | 08fd004fba69ed59a876cb7936748bef7431fb2d | |
parent | 0ce5c1e6dcea6643cf72de885c0aca52bf4ac28c (diff) | |
download | ee-python-450bb482e83c934e67fd5e8f515f240d957f0e31.tar.gz ee-python-450bb482e83c934e67fd5e8f515f240d957f0e31.tar.bz2 ee-python-450bb482e83c934e67fd5e8f515f240d957f0e31.tar.xz ee-python-450bb482e83c934e67fd5e8f515f240d957f0e31.zip |
o Emptying the directory before trying to remove it.
-rw-r--r-- | src/ee/part/__init__.py | 4 |
1 files changed, 4 insertions, 0 deletions
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) |