use _HOME_ for start_sh games
authorNiki Roo <niki@nikiroo.be>
Fri, 26 Dec 2025 13:44:24 +0000 (14:44 +0100)
committerNiki Roo <niki@nikiroo.be>
Fri, 26 Dec 2025 13:44:24 +0000 (14:44 +0100)
gamiki/support/commands.py
gamiki/support/support_gog.py

index 04445d7c2a204351b3faa5c3685b774acda40cd6..d0454e9b942124e27d386f4e5c94fc32c9f5c586 100644 (file)
@@ -1,6 +1,6 @@
 from subprocess import run
 from shutil     import which
-from os         import environ
+from os         import environ, mkdir
 from pathlib    import PurePath
 
 __programs__: dict = { }
@@ -95,6 +95,13 @@ def start_sh(dir: PurePath, link: PurePath, opt: str = None) -> int:
     if (not startsh.exists()):
         return 404;
     
+    home = dir.joinpath("_HOME_")
+    if (not home.exists()):
+        mkdir(home)
+
+    env = environ.copy()
+    env["HOME"] = home.as_posix()
+    
     cmd = startsh.as_posix()
-    return run(cmd, cwd=dir).returncode
+    return run(cmd, cwd=dir, env=env).returncode
 
index 172077551b0a1d1c6e0992daa1becbeda4525b70..9b082cc8059223f1d920307855ea6aef9be6d9e6 100644 (file)
@@ -16,7 +16,7 @@ class SupportGog(Support):
         
         # No running, GoG launcher already does it:
         #self._running(game)
-        rep = start_sh(start)
+        rep = start_sh(game.dir.resolve(), start, opt)
         if (rep != 0):
             self._error(game, rep)