mirror of
https://github.com/ValveSoftware/Proton.git
synced 2024-12-27 07:05:46 +03:00
proton: Add helpers for pre/appending to env var lists
This commit is contained in:
parent
1b975c15dd
commit
25a2a690b0
32
proton
32
proton
@ -28,6 +28,18 @@ ld_path_var = "LD_LIBRARY_PATH"
|
|||||||
def nonzero(s):
|
def nonzero(s):
|
||||||
return len(s) > 0 and s != "0"
|
return len(s) > 0 and s != "0"
|
||||||
|
|
||||||
|
def prepend_to_env_str(env, variable, prepend_str, separator):
|
||||||
|
if not variable in env:
|
||||||
|
env[variable] = prepend_str
|
||||||
|
else:
|
||||||
|
env[variable] = prepend_str + separator + env[variable]
|
||||||
|
|
||||||
|
def append_to_env_str(env, variable, append_str, separator):
|
||||||
|
if not variable in env:
|
||||||
|
env[variable] = append_str
|
||||||
|
else:
|
||||||
|
env[variable] = env[variable] + separator + append_str
|
||||||
|
|
||||||
def log(msg):
|
def log(msg):
|
||||||
sys.stderr.write(PFX + msg + os.linesep)
|
sys.stderr.write(PFX + msg + os.linesep)
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
@ -600,10 +612,7 @@ class Session:
|
|||||||
# Allow wine to restore this when calling an external app.
|
# Allow wine to restore this when calling an external app.
|
||||||
self.env['ORIG_'+ld_path_var] = os.environ.get(ld_path_var, '')
|
self.env['ORIG_'+ld_path_var] = os.environ.get(ld_path_var, '')
|
||||||
|
|
||||||
if ld_path_var in os.environ:
|
prepend_to_env_str(self.env, ld_path_var, g_proton.lib64_dir + ":" + g_proton.lib_dir, ":")
|
||||||
self.env[ld_path_var] = g_proton.lib64_dir + ":" + g_proton.lib_dir + ":" + os.environ[ld_path_var]
|
|
||||||
else:
|
|
||||||
self.env[ld_path_var] = g_proton.lib64_dir + ":" + g_proton.lib_dir
|
|
||||||
|
|
||||||
self.env["WINEDLLPATH"] = g_proton.lib64_dir + "/wine:" + g_proton.lib_dir + "/wine"
|
self.env["WINEDLLPATH"] = g_proton.lib64_dir + "/wine:" + g_proton.lib_dir + "/wine"
|
||||||
|
|
||||||
@ -618,10 +627,7 @@ class Session:
|
|||||||
self.env["MEDIACONV_AUDIO_TRANSCODED_FILE"] = os.environ["STEAM_COMPAT_TRANSCODED_MEDIA_PATH"] + "/transcoded_audio.foz"
|
self.env["MEDIACONV_AUDIO_TRANSCODED_FILE"] = os.environ["STEAM_COMPAT_TRANSCODED_MEDIA_PATH"] + "/transcoded_audio.foz"
|
||||||
self.env["MEDIACONV_VIDEO_TRANSCODED_FILE"] = os.environ["STEAM_COMPAT_TRANSCODED_MEDIA_PATH"] + "/transcoded_video.foz"
|
self.env["MEDIACONV_VIDEO_TRANSCODED_FILE"] = os.environ["STEAM_COMPAT_TRANSCODED_MEDIA_PATH"] + "/transcoded_video.foz"
|
||||||
|
|
||||||
if "PATH" in os.environ:
|
prepend_to_env_str(self.env, "PATH", g_proton.bin_dir, ":")
|
||||||
self.env["PATH"] = g_proton.bin_dir + ":" + os.environ["PATH"]
|
|
||||||
else:
|
|
||||||
self.env["PATH"] = g_proton.bin_dir
|
|
||||||
|
|
||||||
def check_environment(self, env_name, config_name):
|
def check_environment(self, env_name, config_name):
|
||||||
if not env_name in self.env:
|
if not env_name in self.env:
|
||||||
@ -711,10 +717,7 @@ class Session:
|
|||||||
self.env["WINE_LARGE_ADDRESS_AWARE"] = "1"
|
self.env["WINE_LARGE_ADDRESS_AWARE"] = "1"
|
||||||
|
|
||||||
if "vkd3dbindlesstb" in self.compat_config:
|
if "vkd3dbindlesstb" in self.compat_config:
|
||||||
if not "VKD3D_CONFIG" in self.env:
|
append_to_env_str(self.env, "VKD3D_CONFIG", "force_bindless_texel_buffer", ",")
|
||||||
self.env["VKD3D_CONFIG"] = "force_bindless_texel_buffer"
|
|
||||||
else:
|
|
||||||
self.env["VKD3D_CONFIG"] = self.env["VKD3D_CONFIG"] + ",force_bindless_texel_buffer"
|
|
||||||
|
|
||||||
if "vkd3dfl12" in self.compat_config:
|
if "vkd3dfl12" in self.compat_config:
|
||||||
if not "VKD3D_FEATURE_LEVEL" in self.env:
|
if not "VKD3D_FEATURE_LEVEL" in self.env:
|
||||||
@ -762,10 +765,7 @@ class Session:
|
|||||||
s = s + ";" + dll + "=" + setting
|
s = s + ";" + dll + "=" + setting
|
||||||
else:
|
else:
|
||||||
s = dll + "=" + setting
|
s = dll + "=" + setting
|
||||||
if "WINEDLLOVERRIDES" in self.env:
|
append_to_env_str(self.env, "WINEDLLOVERRIDES", s, ";")
|
||||||
self.env["WINEDLLOVERRIDES"] = self.env["WINEDLLOVERRIDES"] + ";" + s
|
|
||||||
else:
|
|
||||||
self.env["WINEDLLOVERRIDES"] = s
|
|
||||||
|
|
||||||
def dump_dbg_env(self, f):
|
def dump_dbg_env(self, f):
|
||||||
f.write("PATH=\"" + self.env["PATH"] + "\" \\\n")
|
f.write("PATH=\"" + self.env["PATH"] + "\" \\\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user