dart: fix deletion logic to avoid deleting existing files

Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
This commit is contained in:
Shengqi Chen 2025-09-10 02:04:21 +08:00
parent a7f40c7813
commit d03842d762
No known key found for this signature in database

View File

@ -141,7 +141,7 @@ def handle_pkg(
if versions_dir.is_dir():
for f in versions_dir.iterdir():
if f.is_file() and f.suffix == ".gz":
ver = f.stem
ver = f.name.removesuffix(".tar.gz")
if ver not in all_versions:
logger.info(f"Removing obsolete pkg file {f.as_posix()}")
f.unlink(missing_ok=True)