mirror of
https://github.com/tcsenpai/UWINE.git
synced 2025-06-06 11:35:20 +00:00
Support a Steam verb as the first argument
To retain Steam's calling convention, check if the first argument is a known verb. If it is and `PROTON_VERB` is unset, assign it to `PROTON_VERB` and remove it from the arguments list. This is a bit hacky but works as PoC
This commit is contained in:
parent
33bd82851a
commit
b24ef40afa
27
ulwgl_run.py
27
ulwgl_run.py
@ -13,6 +13,15 @@ from re import match
|
||||
import subprocess
|
||||
from ulwgl_dl_util import get_ulwgl_proton
|
||||
|
||||
verbs: Set[str] = {
|
||||
"waitforexitandrun",
|
||||
"run",
|
||||
"runinprefix",
|
||||
"destroyprefix",
|
||||
"getcompatpath",
|
||||
"getnativepath",
|
||||
}
|
||||
|
||||
|
||||
def parse_args() -> Union[Namespace, Tuple[str, List[str]]]: # noqa: D103
|
||||
opt_args: Set[str] = {"--help", "-h", "--config"}
|
||||
@ -41,6 +50,11 @@ example usage:
|
||||
if sys.argv[1:][0] in opt_args:
|
||||
return parser.parse_args(sys.argv[1:])
|
||||
|
||||
if sys.argv[1] in verbs:
|
||||
if "PROTON_VERB" not in os.environ:
|
||||
os.environ["PROTON_VERB"] = sys.argv[1]
|
||||
sys.argv.pop(1)
|
||||
|
||||
return sys.argv[1], sys.argv[2:]
|
||||
|
||||
|
||||
@ -120,14 +134,14 @@ def check_env(
|
||||
os.environ["PROTONPATH"] = ""
|
||||
get_ulwgl_proton(env)
|
||||
elif Path("~/.local/share/Steam/compatibilitytools.d/" + os.environ["PROTONPATH"]).expanduser().is_dir():
|
||||
env["PROTONPATH"] = Path("~/.local/share/Steam/compatibilitytools.d/").expanduser().joinpath(os.environ["PROTONPATH"])
|
||||
env["PROTONPATH"] = Path("~/.local/share/Steam/compatibilitytools.d/").expanduser().joinpath(os.environ["PROTONPATH"]).as_posix()
|
||||
elif not Path(os.environ["PROTONPATH"]).expanduser().is_dir():
|
||||
os.environ["PROTONPATH"] = ""
|
||||
get_ulwgl_proton(env)
|
||||
else:
|
||||
env["PROTONPATH"] = os.environ["PROTONPATH"]
|
||||
|
||||
print(env["PROTONPATH"])
|
||||
print(env["PROTONPATH"], file=sys.stderr)
|
||||
|
||||
# If download fails/doesn't exist in the system, raise an error
|
||||
if not os.environ["PROTONPATH"]:
|
||||
@ -144,15 +158,6 @@ def set_env(
|
||||
|
||||
Filesystem paths will be formatted and expanded as POSIX
|
||||
"""
|
||||
verbs: Set[str] = {
|
||||
"waitforexitandrun",
|
||||
"run",
|
||||
"runinprefix",
|
||||
"destroyprefix",
|
||||
"getcompatpath",
|
||||
"getnativepath",
|
||||
}
|
||||
|
||||
# PROTON_VERB
|
||||
# For invalid Proton verbs, just assign the waitforexitandrun
|
||||
if "PROTON_VERB" in os.environ and os.environ["PROTON_VERB"] in verbs:
|
||||
|
Loading…
x
Reference in New Issue
Block a user