From ca03718bf11880e5400e8da5b63a3cd16eb3b08a Mon Sep 17 00:00:00 2001 From: tretrauit Date: Sun, 28 Jan 2024 18:26:48 +0700 Subject: [PATCH] chore: rename _path to path --- vollerei/abc/launcher/game.py | 1 + vollerei/cli/hsr.py | 4 ++-- vollerei/common/functions.py | 2 +- vollerei/hsr/launcher/game.py | 8 ++++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/vollerei/abc/launcher/game.py b/vollerei/abc/launcher/game.py index 6857775..ebb5d45 100644 --- a/vollerei/abc/launcher/game.py +++ b/vollerei/abc/launcher/game.py @@ -10,6 +10,7 @@ class GameABC(ABC): """ path: Path + cache: Path version_override: tuple[int, int, int] | None channel_override: Any diff --git a/vollerei/cli/hsr.py b/vollerei/cli/hsr.py index d8458da..a81fa82 100644 --- a/vollerei/cli/hsr.py +++ b/vollerei/cli/hsr.py @@ -317,7 +317,7 @@ class UpdateCommand(Command): self.line("Update aborted.") return self.line("Downloading update package...") - out_path = State.game._cache.joinpath(update_diff.name) + out_path = State.game.cache.joinpath(update_diff.name) try: download_result = utils.download( update_diff.path, out_path, file_len=update_diff.size @@ -347,7 +347,7 @@ class UpdateCommand(Command): if remote_voicepack.language not in installed_voicepacks: continue # Voicepack is installed, update it - archive_file = State.game._cache.joinpath(remote_voicepack.name) + archive_file = State.game.cache.joinpath(remote_voicepack.name) try: download_result = utils.download( update_diff.path, archive_file, file_len=update_diff.size diff --git a/vollerei/common/functions.py b/vollerei/common/functions.py index 121f09e..91af718 100644 --- a/vollerei/common/functions.py +++ b/vollerei/common/functions.py @@ -67,7 +67,7 @@ def apply_update_archive( # Patch function def extract_and_patch(file, patch_file): - patchpath = game._cache.joinpath(patch_file) + patchpath = game.cache.joinpath(patch_file) # Delete old patch file if exists patchpath.unlink(missing_ok=True) # Extract patch file diff --git a/vollerei/hsr/launcher/game.py b/vollerei/hsr/launcher/game.py index 4b37d3a..8b9dd32 100644 --- a/vollerei/hsr/launcher/game.py +++ b/vollerei/hsr/launcher/game.py @@ -34,8 +34,8 @@ class Game(GameABC): if not cache_path: cache_path = paths.cache_path cache_path = Path(cache_path) - self._cache: Path = cache_path.joinpath("game/hsr/") - self._cache.mkdir(parents=True, exist_ok=True) + self.cache: Path = cache_path.joinpath("game/hsr/") + self.cache.mkdir(parents=True, exist_ok=True) self._version_override: tuple[int, int, int] | None = None self._channel_override: GameChannel | None = None @@ -431,7 +431,7 @@ class Game(GameABC): if not update_info or update_info.version == self.get_version_str(): raise GameAlreadyUpdatedError("Game is already updated.") # Base game update - archive_file = self._cache.joinpath(update_info.name) + archive_file = self.cache.joinpath(update_info.name) download(update_info.path, archive_file) self.apply_update_archive(archive_file=archive_file, auto_repair=auto_repair) # Get installed voicepacks @@ -441,7 +441,7 @@ class Game(GameABC): if remote_voicepack.language not in installed_voicepacks: continue # Voicepack is installed, update it - archive_file = self._cache.joinpath(remote_voicepack.name) + archive_file = self.cache.joinpath(remote_voicepack.name) download(remote_voicepack.path, archive_file) self.apply_update_archive( archive_file=archive_file, auto_repair=auto_repair