fix(common): support zip file

This commit is contained in:
2025-03-03 16:50:51 +07:00
parent 874686a95c
commit 76bccf6a6f

View File

@ -229,8 +229,11 @@ def install_archive(game: GameABC, archive_file: Path | IOBase) -> None:
target_archive = None target_archive = None
if archive_path.suffix == ".001": if archive_path.suffix == ".001":
archive_path = archive_path.with_suffix("") archive_path = archive_path.with_suffix("")
if archive_path.suffix == ".zip":
# .zip split archive
archive = zipfile.ZipFile(archive_path, "r")
else:
target_archive = multivolumefile.open(archive_path, mode='rb') 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") archive = py7zr.SevenZipFile(target_archive, "r")
else: else:
archive = _open_archive(archive_file) archive = _open_archive(archive_file)