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

7
proton
View file

@ -694,7 +694,7 @@ class Session:
except (OSError, IOError, TypeError, KeyError):
pass
def init_session(self):
def init_session(self, update_prefix_files):
self.env["WINEPREFIX"] = g_compatdata.prefix_dir
#load environment overrides
@ -812,6 +812,7 @@ class Session:
else:
self.env["WINEDEBUG"] = "-all"
if update_prefix_files:
g_compatdata.setup_prefix()
if "nod3d11" in self.compat_config:
@ -983,7 +984,7 @@ if __name__ == "__main__":
if g_proton.missing_default_prefix():
g_proton.make_default_prefix()
g_session.init_session()
g_session.init_session(sys.argv[1] != "runinprefix")
#determine mode
if sys.argv[1] == "run":
@ -994,6 +995,8 @@ if __name__ == "__main__":
g_session.run_proc([g_proton.wineserver_bin, "-w"])
#then 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":
#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)