From 76bccf6a6f0c3ef2046b9a0ebe204370b95472a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=E1=BA=BF=20H=C6=B0ng?= Date: Mon, 3 Mar 2025 16:50:51 +0700 Subject: [PATCH] fix(common): support zip file --- vollerei/common/functions.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vollerei/common/functions.py b/vollerei/common/functions.py index 7d2d8b8..5192290 100644 --- a/vollerei/common/functions.py +++ b/vollerei/common/functions.py @@ -229,9 +229,12 @@ def install_archive(game: GameABC, archive_file: Path | IOBase) -> None: target_archive = None if archive_path.suffix == ".001": archive_path = archive_path.with_suffix("") - target_archive = multivolumefile.open(archive_path, mode='rb') - # TODO: Implement for .zip file (but I doubt it's needed cuz miHoYo uses 7z) - archive = py7zr.SevenZipFile(target_archive, "r") + if archive_path.suffix == ".zip": + # .zip split archive + archive = zipfile.ZipFile(archive_path, "r") + else: + target_archive = multivolumefile.open(archive_path, mode='rb') + archive = py7zr.SevenZipFile(target_archive, "r") else: archive = _open_archive(archive_file) archive.extractall(game.path)