Skip to content

Commit

Permalink
fixup issue with UMU_ID
Browse files Browse the repository at this point in the history
  • Loading branch information
GloriousEggroll committed Mar 21, 2024
1 parent 46afadc commit 0237fb4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions tools/umu-run-posix
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ if [ -n "$PROTONPATH" ]; then
fi
fi

export umu_ID="$GAMEID"
export UMU_ID="$GAMEID"
export STEAM_COMPAT_APP_ID="0"
numcheck='^[0-9]+$'
if echo "$umu_ID" | cut -d "-" -f 2 | grep -Eq "$numcheck"; then
STEAM_COMPAT_APP_ID=$(echo "$umu_ID" | cut -d "-" -f 2)
if echo "$UMU_ID" | cut -d "-" -f 2 | grep -Eq "$numcheck"; then
STEAM_COMPAT_APP_ID=$(echo "$UMU_ID" | cut -d "-" -f 2)
export STEAM_COMPAT_APP_ID
fi
export SteamAppId="$STEAM_COMPAT_APP_ID"
Expand Down
2 changes: 1 addition & 1 deletion umu/umu_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def enable_reaper(env: Dict[str, str], command: List[str], local: Path) -> List[
command.extend(
[
local.joinpath("reaper").as_posix(),
"umu_ID=" + env["umu_ID"],
"UMU_ID=" + env["UMU_ID"],
"--",
]
)
Expand Down
12 changes: 6 additions & 6 deletions umu/umu_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def check_env(

if "WINEPREFIX" not in os.environ:
id: str = env["GAMEID"]
pfx: Path = Path.home().joinpath("Games", "umu", f"umu-{id}")
pfx: Path = Path.home().joinpath("Games", "umu", f"{id}")
pfx.mkdir(parents=True, exist_ok=True)
os.environ["WINEPREFIX"] = pfx.as_posix()
if not Path(os.environ["WINEPREFIX"]).expanduser().is_dir():
Expand Down Expand Up @@ -190,12 +190,12 @@ def set_env(
if "STORE" in os.environ:
env["STORE"] = os.environ["STORE"]

# umu_ID
env["umu_ID"] = env["GAMEID"]
# UMU_ID
env["UMU_ID"] = env["GAMEID"]
env["STEAM_COMPAT_APP_ID"] = "0"

if match(r"^umu-[\d\w]+$", env["umu_ID"]):
env["STEAM_COMPAT_APP_ID"] = env["umu_ID"][env["umu_ID"].find("-") + 1 :]
if match(r"^umu-[\d\w]+$", env["UMU_ID"]):
env["STEAM_COMPAT_APP_ID"] = env["UMU_ID"][env["UMU_ID"].find("-") + 1 :]
env["SteamAppId"] = env["STEAM_COMPAT_APP_ID"]
env["SteamGameId"] = env["SteamAppId"]

Expand Down Expand Up @@ -269,7 +269,7 @@ def main() -> int: # noqa: D103
"STEAM_RUNTIME_LIBRARY_PATH": "",
"STORE": "",
"PROTON_VERB": "",
"umu_ID": "",
"UMU_ID": "",
}
command: List[str] = []
opts: List[str] = None
Expand Down
20 changes: 10 additions & 10 deletions umu/umu_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def setUp(self):
"SteamAppId": "",
"SteamGameId": "",
"STEAM_RUNTIME_LIBRARY_PATH": "",
"umu_ID": "",
"UMU_ID": "",
"STORE": "",
"PROTON_VERB": "",
}
Expand Down Expand Up @@ -1599,10 +1599,10 @@ def test_set_env_id(self):
"""Test set_env.
Verify that environment variables (dictionary) are set after calling
set_env when passing a valid umu_ID
set_env when passing a valid UMU_ID
When a valid umu_ID is set, the STEAM_COMPAT_APP_ID variables
should be the stripped umu_ID
When a valid UMU_ID is set, the STEAM_COMPAT_APP_ID variables
should be the stripped UMU_ID
"""
result = None
test_str = "foo"
Expand Down Expand Up @@ -1655,16 +1655,16 @@ def test_set_env_id(self):
)
# umu
self.assertEqual(
self.env["umu_ID"],
self.env["UMU_ID"],
self.env["GAMEID"],
"Expected umu_ID to be GAMEID",
"Expected UMU_ID to be GAMEID",
)
self.assertEqual(self.env["umu_ID"], umu_id, "Expected umu_ID")
self.assertEqual(self.env["UMU_ID"], umu_id, "Expected UMU_ID")
# Should be stripped -- everything after the hyphen
self.assertEqual(
self.env["STEAM_COMPAT_APP_ID"],
umu_id[umu_id.find("-") + 1 :],
"Expected STEAM_COMPAT_APP_ID to be the stripped umu_ID",
"Expected STEAM_COMPAT_APP_ID to be the stripped UMU_ID",
)
self.assertEqual(
self.env["SteamAppId"],
Expand Down Expand Up @@ -1752,9 +1752,9 @@ def test_set_env(self):
)
# umu
self.assertEqual(
self.env["umu_ID"],
self.env["UMU_ID"],
self.env["GAMEID"],
"Expected umu_ID to be GAMEID",
"Expected UMU_ID to be GAMEID",
)
self.assertEqual(
self.env["STEAM_COMPAT_APP_ID"],
Expand Down
2 changes: 1 addition & 1 deletion umu/umu_test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def setUp(self):
"SteamAppId": "",
"SteamGameId": "",
"STEAM_RUNTIME_LIBRARY_PATH": "",
"umu_ID": "",
"UMU_ID": "",
"STORE": "",
"PROTON_VERB": "",
}
Expand Down

0 comments on commit 0237fb4

Please sign in to comment.