fix(common): manually close the merged archive
This commit is contained in:
@ -226,15 +226,18 @@ def install_archive(game: GameABC, archive_file: Path | IOBase) -> None:
|
||||
"""
|
||||
archive: py7zr.SevenZipFile | zipfile.ZipFile = None
|
||||
archive_path = Path(archive_file)
|
||||
target_archive = None
|
||||
if archive_path.suffix == ".001":
|
||||
archive_path = archive_path.with_suffix("")
|
||||
with multivolumefile.open(archive_path, mode='rb') as target_archive:
|
||||
# TODO: Implement for .zip file (but I doubt it's needed cuz miHoYo uses 7z)
|
||||
archive = py7zr.SevenZipFile(target_archive, "r")
|
||||
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")
|
||||
else:
|
||||
archive = _open_archive(archive_file)
|
||||
archive.extractall(game.path)
|
||||
archive.close()
|
||||
if target_archive:
|
||||
target_archive.close()
|
||||
|
||||
|
||||
def _repair_file(game: GameABC, file: PathLike, game_info: resource.Main) -> None:
|
||||
|
||||
Reference in New Issue
Block a user