From 3b3345964a1d8c8361dae67f13d0fda3dd9808ca Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Mon, 1 Apr 2024 18:36:51 +0100 Subject: [PATCH] fix(WVD): Add exists/empty checks to WVD folder dumps --- devine/commands/wvd.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/devine/commands/wvd.py b/devine/commands/wvd.py index 087021f..6e9a4dd 100644 --- a/devine/commands/wvd.py +++ b/devine/commands/wvd.py @@ -123,7 +123,15 @@ def dump(wvd_paths: list[Path], out_dir: Path) -> None: log = logging.getLogger("wvd") if wvd_paths == (): - wvd_paths = list(config.directories.wvds.iterdir()) + if not config.directories.wvds.exists(): + console.log(f"[bright_blue]{config.directories.wvds.absolute()}[/] does not exist...") + wvd_paths = list( + x + for x in config.directories.wvds.iterdir() + if x.is_file() and x.suffix.lower() == ".wvd" + ) + if not wvd_paths: + console.log(f"[bright_blue]{config.directories.wvds.absolute()}[/] is empty...") for i, (wvd_path, out_path) in enumerate(zip(wvd_paths, (out_dir / x.stem for x in wvd_paths))): if i > 0: