allow using shortname of proton version as alternative to full file path

This commit is contained in:
GloriousEggroll 2024-02-19 14:30:20 -07:00
parent c116d7dbf9
commit 33bd82851a

View File

@ -116,16 +116,19 @@ def check_env(
raise ValueError(err) raise ValueError(err)
env["GAMEID"] = os.environ["GAMEID"] env["GAMEID"] = os.environ["GAMEID"]
if ( if "PROTONPATH" not in os.environ:
"PROTONPATH" not in os.environ os.environ["PROTONPATH"] = ""
or not Path(os.environ["PROTONPATH"]).expanduser().is_dir() get_ulwgl_proton(env)
): elif Path("~/.local/share/Steam/compatibilitytools.d/" + os.environ["PROTONPATH"]).expanduser().is_dir():
# Attempt to auto set this env var for the user env["PROTONPATH"] = Path("~/.local/share/Steam/compatibilitytools.d/").expanduser().joinpath(os.environ["PROTONPATH"])
elif not Path(os.environ["PROTONPATH"]).expanduser().is_dir():
os.environ["PROTONPATH"] = "" os.environ["PROTONPATH"] = ""
get_ulwgl_proton(env) get_ulwgl_proton(env)
else: else:
env["PROTONPATH"] = os.environ["PROTONPATH"] env["PROTONPATH"] = os.environ["PROTONPATH"]
print(env["PROTONPATH"])
# If download fails/doesn't exist in the system, raise an error # If download fails/doesn't exist in the system, raise an error
if not os.environ["PROTONPATH"]: if not os.environ["PROTONPATH"]:
err: str = "Download failed.\nProton could not be found in cache or compatibilitytools.d\nPlease set $PROTONPATH or visit https://github.com/Open-Wine-Components/ULWGL-Proton/releases" err: str = "Download failed.\nProton could not be found in cache or compatibilitytools.d\nPlease set $PROTONPATH or visit https://github.com/Open-Wine-Components/ULWGL-Proton/releases"