about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2026-07-05 12:40:38 +0300
committerAndrew Dolgov <fox@fakecake.org>2026-07-05 12:40:38 +0300
commitb9c9e8d330a3d9652dc4564bc9c544f413a9161c (patch)
treebe24ba14fed9767cd2e858f1b3646a2b4f1f3ba3
parentc787b02b3c3fae9ed49c3dbd1d8d41ea017fefee (diff)
downloadfungus-launcher-b9c9e8d330a3d9652dc4564bc9c544f413a9161c.tar.gz
fungus-launcher-b9c9e8d330a3d9652dc4564bc9c544f413a9161c.tar.xz
simplify previous
-rw-r--r--fungus/game_launcher.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/fungus/game_launcher.py b/fungus/game_launcher.py
index 1c2740f..685b516 100644
--- a/fungus/game_launcher.py
+++ b/fungus/game_launcher.py
@@ -411,9 +411,6 @@ class GameLauncher:
         # Check whitelist
         exec_path = self.game.path
 
-        # We need this to set work directory for popen later
-        exec_dir = os.path.dirname(exec_path)
-
         log.debug("sandbox-check: exec_path=%r", exec_path)
         if exec_path and valid_dirs and not self._check_whitelist(exec_path, valid_dirs):
             if self._on_sandbox_warning:
@@ -433,6 +430,8 @@ class GameLauncher:
         full_cmd = bwrap_cmd + inner_cmd
 
         try:
+            # we invoke popen() setting work directory as a dirname() of our executable
+            # this seems to be a common practice for launchers
             self.process = subprocess.Popen(
                 full_cmd,
                 stdout=subprocess.PIPE,
@@ -440,7 +439,7 @@ class GameLauncher:
                 bufsize=8192,
                 text=True,
                 env=run_env,
-                cwd=exec_dir
+                cwd=os.path.dirname(exec_path)
             )
         except (FileNotFoundError, OSError) as exc:
             error_msg = (