From 737686a88d54f8ace38f8b577d54d55f5b6c4250 Mon Sep 17 00:00:00 2001 From: Bryce Wilson Date: Tue, 28 Nov 2023 13:56:27 -0800 Subject: [PATCH] BizHawkClient: Use `local_path` when autolaunching BizHawk with lua script (#2526) * BizHawkClient: Change autolaunch path to lua script to use local_path * BizHawkClient: Remove unnecessary call to os.path.join and linting --- worlds/_bizhawk/context.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/worlds/_bizhawk/context.py b/worlds/_bizhawk/context.py index 2699b0f5f106..4ee6e24f591d 100644 --- a/worlds/_bizhawk/context.py +++ b/worlds/_bizhawk/context.py @@ -208,19 +208,30 @@ async def _run_game(rom: str): if auto_start is True: emuhawk_path = Utils.get_settings().bizhawkclient_options.emuhawk_path - subprocess.Popen([emuhawk_path, "--lua=data/lua/connector_bizhawk_generic.lua", os.path.realpath(rom)], - cwd=Utils.local_path("."), - stdin=subprocess.DEVNULL, - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL) + subprocess.Popen( + [ + emuhawk_path, + f"--lua={Utils.local_path('data', 'lua', 'connector_bizhawk_generic.lua')}", + os.path.realpath(rom), + ], + cwd=Utils.local_path("."), + stdin=subprocess.DEVNULL, + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + ) elif isinstance(auto_start, str): import shlex - subprocess.Popen([*shlex.split(auto_start), os.path.realpath(rom)], - cwd=Utils.local_path("."), - stdin=subprocess.DEVNULL, - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL) + subprocess.Popen( + [ + *shlex.split(auto_start), + os.path.realpath(rom) + ], + cwd=Utils.local_path("."), + stdin=subprocess.DEVNULL, + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL + ) async def _patch_and_run_game(patch_file: str):