chore: rename _path to path

This commit is contained in:
tretrauit 2024-01-28 18:26:48 +07:00
parent 9f9a63c9b0
commit ca03718bf1
4 changed files with 8 additions and 7 deletions

View File

@ -10,6 +10,7 @@ class GameABC(ABC):
"""
path: Path
cache: Path
version_override: tuple[int, int, int] | None
channel_override: Any

View File

@ -317,7 +317,7 @@ class UpdateCommand(Command):
self.line("<error>Update aborted.</error>")
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

View File

@ -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

View File

@ -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