From 504bf52b4074f859d7e22afa7546b0fc1bb87d6b Mon Sep 17 00:00:00 2001 From: Stelios Tsampas Date: Mon, 6 Jan 2025 19:52:05 +0200 Subject: [PATCH] umu_util: use directory as name if `compatibilitytool.vdf` doesn't exist Valve's Protons do not have a `compatibilitytool.vdf`. Instead of trying to work backwards and read their appmanifest, use the directory as name. --- umu/umu_util.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/umu/umu_util.py b/umu/umu_util.py index a02e334da..e21a432c8 100644 --- a/umu/umu_util.py +++ b/umu/umu_util.py @@ -384,13 +384,17 @@ class CompatibilityTool(SteamBase): def __init__(self, tool_path: str, shim: Path, runtime: SteamRuntime | None) -> None: # noqa: D107 super().__init__(tool_path) + _tool_path = Path(tool_path) self.shim = shim self.runtime = runtime if self.required_tool_appid is not None else None - with Path(tool_path).joinpath("compatibilitytool.vdf").open(encoding="utf-8") as f: - # There can be multiple tools definitions in `compatibilitytools.vdf` - # Take the first one and hope it is the one with the correct display_name - compat_tools = tuple(vdf.load(f)["compatibilitytools"]["compat_tools"].values()) - self.compatibility_tool = compat_tools[0] + if _tool_path.joinpath("compatibilitytool.vdf").exists(): + with _tool_path.joinpath("compatibilitytool.vdf").open(encoding="utf-8") as f: + # There can be multiple tools definitions in `compatibilitytools.vdf` + # Take the first one and hope it is the one with the correct display_name + compat_tools = tuple(vdf.load(f)["compatibilitytools"]["compat_tools"].values()) + self.compatibility_tool = compat_tools[0] + else: + self.compatibility_tool = {"display_name": _tool_path.name} @property def display_name(self) -> str | None: # noqa: D102