Skip to content

Commit

Permalink
umu_util: use directory as name if compatibilitytool.vdf doesn't exist
Browse files Browse the repository at this point in the history
Valve's Protons do not have a `compatibilitytool.vdf`. Instead of trying
to work backwards and read their appmanifest, use the directory as name.
  • Loading branch information
loathingKernel committed Jan 6, 2025
1 parent 8f8f81a commit 504bf52
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions umu/umu_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 504bf52

Please sign in to comment.