@@ -1,5 +1,5 @@
11diff --git a/src/protontricks/cli.py b/src/protontricks/cli.py
2−index 6506dae..2f762c9 100755
2+index fec0563..d158b96 100755
33--- a/src/protontricks/cli.py
44+++ b/src/protontricks/cli.py
55@@ -14,7 +14,7 @@ import os
@@ -38,7 +38,7 @@ index 6506dae..2f762c9 100755
3838 else:
3939 logger.info("Steam Runtime disabled.")
4040
41−@@ -194,7 +189,7 @@ def main(args=None):
41+@@ -201,7 +196,7 @@ def main(args=None):
4242 winetricks_path=winetricks_path,
4343 proton_app=proton_app,
4444 steam_app=steam_app,
@@ -46,8 +46,8 @@ index 6506dae..2f762c9 100755
4646+ steam_runtime=steam_runtime,
4747 command=[winetricks_path, "--gui"]
4848 )
49− return
50−@@ -261,7 +256,7 @@ def main(args=None):
49+
50+@@ -269,7 +264,7 @@ def main(args=None):
5151 winetricks_path=winetricks_path,
5252 proton_app=proton_app,
5353 steam_app=steam_app,
@@ -56,7 +56,7 @@ index 6506dae..2f762c9 100755
5656 command=[winetricks_path] + args.winetricks_command)
5757 elif args.command:
5858 run_command(
59−@@ -269,7 +264,7 @@ def main(args=None):
59+@@ -277,7 +272,7 @@ def main(args=None):
6060 proton_app=proton_app,
6161 steam_app=steam_app,
6262 command=args.command,
@@ -66,7 +66,7 @@ index 6506dae..2f762c9 100755
6666 # escaping it
6767 cwd=steam_app.install_path,
6868diff --git a/src/protontricks/steam.py b/src/protontricks/steam.py
69−index 215b31d..aa545b8 100644
69+index fa5772d..4f30cd3 100644
7070--- a/src/protontricks/steam.py
7171+++ b/src/protontricks/steam.py
7272@@ -11,7 +11,7 @@ from .util import lower_dict
@@ -78,7 +78,7 @@ index 215b31d..aa545b8 100644
7878 "find_appid_proton_prefix", "get_steam_lib_paths", "get_steam_apps",
7979 "get_custom_proton_installations"
8080 )
81−@@ -245,37 +245,6 @@ def find_steam_path():
81+@@ -254,37 +254,6 @@ def find_steam_path():
8282 return None, None
8383
8484
@@ -117,7 +117,7 @@ index 215b31d..aa545b8 100644
117117 APPINFO_STRUCT_SECTION = "<LLLLQ20sL"
118118
119119diff --git a/src/protontricks/util.py b/src/protontricks/util.py
120−index a850427..390fc01 100644
120+index d513b46..c48e41f 100644
121121--- a/src/protontricks/util.py
122122+++ b/src/protontricks/util.py
123123@@ -6,7 +6,7 @@ import stat
@@ -129,7 +129,7 @@ index a850427..390fc01 100644
129129
130130 logger = logging.getLogger("protontricks")
131131
132−@@ -25,70 +25,10 @@ def lower_dict(d):
132+@@ -25,93 +25,10 @@ def lower_dict(d):
133133 return {k.lower(): v for k, v in d.items()}
134134
135135
@@ -155,26 +155,49 @@ index a850427..390fc01 100644
155155- return ":".join(paths)
156156-
157157-
158+-RUNTIME_ROOT_GLOB_PATTERNS = (
159+- "var/*/files/",
160+- "*/files/"
161+-)
162+-
163+-
158164-def get_runtime_library_paths(steam_runtime_path, proton_app):
159165- """
160166- Get LD_LIBRARY_PATH value to run a command using Steam Runtime
161167- """
162−- if proton_app.required_tool_app:
168+- def find_runtime_app_root(runtime_app):
169+- """
170+- Find the runtime root (the directory containing the root fileystem
171+- used for the container) for separately installed Steam Runtime app
172+- """
173+- for pattern in RUNTIME_ROOT_GLOB_PATTERNS:
174+- try:
175+- return next(
176+- runtime_app.install_path.glob(pattern)
177+- )
178+- except StopIteration:
179+- pass
180+-
181+- raise RuntimeError(
182+- "Could not find Steam Runtime runtime root for {}".format(
183+- runtime_app.name
184+- )
185+- )
186+-
187+- if proton_app.required_tool_appid:
163188- # bwrap based Steam Runtime is used for Proton installations that
164189- # use separate Steam runtimes
165190- # TODO: Try to run the Wine binaries inside an user namespace somehow.
166191- # Newer Steam Runtime environments may rely on a newer glibc than what
167192- # is available on the host system, which may cause potential problems
168193- # otherwise.
169−- runtime_root = next(
170−- proton_app.required_tool_app.install_path.glob("*/files/")
171−- )
194+- runtime_root = find_runtime_app_root(proton_app.required_tool_app)
172195- return "".join([
173196- str(proton_app.install_path / "dist" / "lib"), os.pathsep,
174197- str(proton_app.install_path / "dist" / "lib64"), os.pathsep,
175198- get_host_library_paths(), os.pathsep,
176−- str(runtime_root / "i686-pc-linux-gnu" / "lib"), os.pathsep,
177−- str(runtime_root / "x86_64-pc-linux-gnu" / "lib")
199+- str(runtime_root / "lib" / "i386-linux-gnu"), os.pathsep,
200+- str(runtime_root / "lib" / "x86_64-linux-gnu")
178201- ])
179202-
180203- # Traditional LD_LIBRARY_PATH based Steam Runtime is used otherwise
@@ -202,7 +225,7 @@ index a850427..390fc01 100644
202225 )
203226
204227
205−@@ -149,7 +89,7 @@ def create_wine_bin_dir(proton_app):
228+@@ -172,7 +89,7 @@ def create_wine_bin_dir(proton_app):
206229
207230 def run_command(
208231 winetricks_path, proton_app, steam_app, command,
@@ -211,16 +234,23 @@ index a850427..390fc01 100644
211234 **kwargs):
212235 """Run an arbitrary command with the correct environment variables
213236 for the given Proton app
214−@@ -157,7 +97,7 @@ def run_command(
237+@@ -180,13 +97,13 @@ def run_command(
215238 The environment variables are set for the duration of the call
216239 and restored afterwards
217240
218241- If 'steam_runtime_path' is provided, run the command using Steam Runtime
219242+ If 'steam_runtime' is provided, run the command using Steam Runtime
220243 """
221− # Make a copy of the environment variables to restore later
222− environ_copy = os.environ.copy()
223−@@ -200,7 +140,7 @@ def run_command(
244+ # Check for incomplete Steam Runtime installation
245+ runtime_install_incomplete = \
246+ proton_app.required_tool_appid and not proton_app.required_tool_app
247+
248+- if steam_runtime_path and runtime_install_incomplete:
249++ if steam_runtime and runtime_install_incomplete:
250+ raise RuntimeError(
251+ "{} is missing the required Steam Runtime. You may need to launch "
252+ "a Steam app using this Proton version to finish the "
253+@@ -234,7 +151,7 @@ def run_command(
224254 os.environ.pop("WINEARCH", "")
225255
226256 wine_bin_dir = None
@@ -229,7 +259,7 @@ index a850427..390fc01 100644
229259 if proton_app.required_tool_app:
230260 runtime_name = proton_app.required_tool_app.name
231261 logger.info(
232−@@ -217,8 +157,6 @@ def run_command(
262+@@ -251,8 +168,6 @@ def run_command(
233263 # that load the underlying Proton Wine executables with Steam Runtime
234264 # and Proton libraries instead of system libraries
235265 wine_bin_dir = create_wine_bin_dir(proton_app=proton_app)
@@ -239,10 +269,10 @@ index a850427..390fc01 100644
239269 str(wine_bin_dir), os.pathsep, os.environ["PATH"]
240270 ])
241271diff --git a/tests/test_cli.py b/tests/test_cli.py
242−index 19e1137..2ef56d6 100644
272+index b612dfa..c4d1de0 100644
243273--- a/tests/test_cli.py
244274+++ b/tests/test_cli.py
245−@@ -114,9 +114,6 @@ class TestCLIRun:
275+@@ -115,9 +115,6 @@ class TestCLIRun:
246276 assert str(command.args[0]).endswith(".local/bin/winetricks")
247277 assert command.args[1] == "winecfg"
248278 assert command.env["PATH"].startswith(str(wine_bin_dir))