diff --git a/make_game.py b/make_game.py index 03d93a2b8b..06f9179e6d 100644 --- a/make_game.py +++ b/make_game.py @@ -2524,6 +2524,11 @@ def wine_launcher(out: str, work: str, image: str) -> str: here=$(dirname "$(readlink -f "$0")") if [ "$#" -eq 1 ] && {{ [ "$1" = --dry-run ] || [ "$1" = --init ] || [ "$1" = --run ]; }}; then game=$(cat "$here/game_path.txt" && printf .) || exit 1 + # A relative WINE (a Proton build's files/bin/wine) names a file from the caller's folder, not the game's. + case ${{WINE-}} in + /*) ;; + */*) WINE=$PWD/$WINE ;; + esac cd "${{game%.}}" || exit 1 image={shlex.quote(image)} if [ ! -f "./$image" ]; then diff --git a/tests/test_make_game_platform.py b/tests/test_make_game_platform.py index 9da2133677..d90ea810c4 100644 --- a/tests/test_make_game_platform.py +++ b/tests/test_make_game_platform.py @@ -278,6 +278,15 @@ def real(path): result = subprocess.check_output([launcher, "--run", "other.exe", "--", "two words"], cwd=self.root, env=env) self.assertEqual(json.loads(result)[:2], [real(self.root), ["--run", "other.exe", "--", "two words"]]) + # A relative WINE names a file from the caller's folder, although the packaged modes start in the game's. + proton = os.path.join(self.root, "Proton 9.0", "files", "bin") + os.makedirs(proton) + os.symlink(sys.executable, os.path.join(proton, "wine")) + relative = dict(env, WINE=os.path.join("Proton 9.0", "files", "bin", "wine")) + result = subprocess.check_output([launcher, "--dry-run"], cwd=self.root, env=relative) + self.assertEqual(json.loads(result)[:2], [real(self.game), ["--dry-run", "./" + image, "--overlay", + "Z:" + real(self.out) + "/overlay"]]) + work = os.path.join(self.out, "Shader cache '$HOME'") make_game.runtime(self.game, self.out, {"expected_exe": image}, self.build, work=work) moved = self.out + " moved"