change ulwgl-run path to auto-find based on 'which ulwgl-run' output

fixup
This commit is contained in:
GloriousEggroll 2024-02-26 18:54:43 -07:00
parent daa3eea2e9
commit f4cfc6f3e6
2 changed files with 10 additions and 5 deletions

View file

@ -3,6 +3,7 @@
import os
import shlex
import time
import subprocess
from lutris import runtime, settings
from lutris.command import MonitoredCommand
@ -152,8 +153,9 @@ def create_prefix( # noqa: C901
# TODO: Determine and insert GAMEID and STORE
wineenv["GAMEID"] = "ulwgl-foo"
wineenv["PROTONPATH"] = settings.RUNNER_DIR
ulwgl_path = os.path.join(os.path.join(settings.RUNTIME_DIR, "ulwgl"))
system.execute([os.path.join(ulwgl_path, "ulwgl-run"), "createprefix"], env=wineenv)
result = subprocess.run(['which', 'ulwgl-run'], stdout=subprocess.PIPE, text=True)
ulwgl_path = result.stdout.strip()
system.execute([ulwgl_path, "createprefix"], env=wineenv)
logger.info("%s Prefix created in %s", arch, prefix)
prefix_manager = WinePrefixManager(prefix)
@ -324,7 +326,8 @@ def wineexec( # noqa: C901
baseenv.update(env)
if "Proton" in wine_path:
ulwgl_path = os.path.join(os.path.join(settings.RUNTIME_DIR, "ulwgl"), "ulwgl-run")
result = subprocess.run(['which', 'ulwgl-run'], stdout=subprocess.PIPE, text=True)
ulwgl_path = result.stdout.strip()
wine_path = ulwgl_path
command_parameters = [wine_path]

View file

@ -2,6 +2,7 @@
# pylint: disable=too-many-lines
import os
import shlex
import subprocess
from gettext import gettext as _
from typing import Dict, Tuple
@ -1173,9 +1174,10 @@ class wine(Runner):
def get_command(self):
exe = self.get_executable()
ulwgl_path = os.path.join(os.path.join(settings.RUNTIME_DIR, "ulwgl"))
result = subprocess.run(['which', 'ulwgl-run'], stdout=subprocess.PIPE, text=True)
ulwgl_path = result.stdout.strip()
if "Proton" in exe and "lutris" not in exe and system.path_exists(ulwgl_path):
return [os.path.join(ulwgl_path, "ulwgl-run")]
return [ulwgl_path]
return super().get_command()
def play(self): # pylint: disable=too-many-return-statements # noqa: C901