proton: Add runinprefix verb for running a program in a running session

CW-Bug-Id: 16785
This commit is contained in:
Jacek Caban 2021-05-11 17:07:14 -05:00 committed by Andrew Eikum
parent ec9bf7f85d
commit f632b693bd

9
proton
View file

@ -694,7 +694,7 @@ class Session:
except (OSError, IOError, TypeError, KeyError): except (OSError, IOError, TypeError, KeyError):
pass pass
def init_session(self): def init_session(self, update_prefix_files):
self.env["WINEPREFIX"] = g_compatdata.prefix_dir self.env["WINEPREFIX"] = g_compatdata.prefix_dir
#load environment overrides #load environment overrides
@ -812,7 +812,8 @@ class Session:
else: else:
self.env["WINEDEBUG"] = "-all" self.env["WINEDEBUG"] = "-all"
g_compatdata.setup_prefix() if update_prefix_files:
g_compatdata.setup_prefix()
if "nod3d11" in self.compat_config: if "nod3d11" in self.compat_config:
self.dlloverrides["d3d11"] = "" self.dlloverrides["d3d11"] = ""
@ -983,7 +984,7 @@ if __name__ == "__main__":
if g_proton.missing_default_prefix(): if g_proton.missing_default_prefix():
g_proton.make_default_prefix() g_proton.make_default_prefix()
g_session.init_session() g_session.init_session(sys.argv[1] != "runinprefix")
#determine mode #determine mode
if sys.argv[1] == "run": if sys.argv[1] == "run":
@ -994,6 +995,8 @@ if __name__ == "__main__":
g_session.run_proc([g_proton.wineserver_bin, "-w"]) g_session.run_proc([g_proton.wineserver_bin, "-w"])
#then run #then run
g_session.run() g_session.run()
elif sys.argv[1] == "runinprefix":
g_session.run_proc([g_proton.wine_bin] + sys.argv[2:])
elif sys.argv[1] == "getcompatpath": elif sys.argv[1] == "getcompatpath":
#linux -> windows path #linux -> windows path
path = subprocess.check_output([g_proton.wine_bin, "winepath", "-w", sys.argv[2]], env=g_session.env, stderr=g_session.log_file) path = subprocess.check_output([g_proton.wine_bin, "winepath", "-w", sys.argv[2]], env=g_session.env, stderr=g_session.log_file)