From 1c027fc14aa4e4d420e9787565bf374dee3c42a2 Mon Sep 17 00:00:00 2001 From: loathingKernel <142770+loathingKernel@users.noreply.github.com> Date: Thu, 22 Feb 2024 21:19:05 +0200 Subject: [PATCH] Steam: Fix crash if Steam is not installed --- rare/utils/compat/steam.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rare/utils/compat/steam.py b/rare/utils/compat/steam.py index 624d5539..ec4428c4 100644 --- a/rare/utils/compat/steam.py +++ b/rare/utils/compat/steam.py @@ -16,11 +16,12 @@ logger = getLogger("Proton") steam_compat_client_install_paths = [os.path.expanduser("~/.local/share/Steam")] -def find_steam() -> str: +def find_steam() -> Optional[str]: # return the first valid path for path in steam_compat_client_install_paths: if os.path.isdir(path) and os.path.isfile(os.path.join(path, "steam.sh")): return path + return None def find_libraries(steam_path: str) -> Set[str]: @@ -306,7 +307,11 @@ def get_steam_environment( def find_tools() -> List[Union[ProtonTool, CompatibilityTool]]: steam_path = find_steam() - logger.debug("Using Steam install in %s", steam_path) + if steam_path is None: + logger.info("Steam could not be found") + return [] + logger.info("Found Steam in %s", steam_path) + steam_libraries = find_libraries(steam_path) logger.debug("Searching for tools in libraries:") logger.debug("%s", steam_libraries)