hsr/get_version: prevent reading data.unity3d if not exist
This commit is contained in:
parent
f6c9f2ddfe
commit
59da35f1df
@ -56,6 +56,10 @@ class Game(GameABC):
|
|||||||
tuple[int, int, int]: The version as a tuple of integers.
|
tuple[int, int, int]: The version as a tuple of integers.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
data_file = self.data_folder().joinpath("data.unity3d")
|
||||||
|
if not data_file.exists():
|
||||||
|
return (0, 0, 0)
|
||||||
|
|
||||||
def bytes_to_int(byte_array: list[bytes]) -> int:
|
def bytes_to_int(byte_array: list[bytes]) -> int:
|
||||||
bytes_as_int = int.from_bytes(byte_array, byteorder="big")
|
bytes_as_int = int.from_bytes(byte_array, byteorder="big")
|
||||||
actual_int = bytes_as_int - 48 # 48 is the ASCII code for 0
|
actual_int = bytes_as_int - 48 # 48 is the ASCII code for 0
|
||||||
|
Loading…
Reference in New Issue
Block a user