diff options
Diffstat (limited to 'lib/gui/electron.py')
| -rwxr-xr-x[-rw-r--r--] | lib/gui/electron.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/gui/electron.py b/lib/gui/electron.py index dcf03c6f..651080a9 100644..100755 --- a/lib/gui/electron.py +++ b/lib/gui/electron.py @@ -22,7 +22,7 @@ def open_url(url): electron_path = os.path.join(get_bundled_dir("electron"), "inkstitch-gui") if sys.platform == "darwin": - electron_path += ".app/Contents/MacOS/inkstitch-gui" + electron_path = os.path.join(sys._MEIPASS, "electron", "inkstitch-gui.app", "Contents", "MacOS", "inkstitch-gui") command = ["open", "-W", "-a", electron_path, "--args", url] else: command = [electron_path, url] @@ -32,5 +32,18 @@ def open_url(url): cwd = get_bundled_dir("electron") # Any output on stdout will crash inkscape. - with open(os.devnull, 'w') as null: - return subprocess.Popen(command, cwd=cwd, stdout=null) + # In macos manual install the python env paths are incomplete + # Adding the yarn path to the env paths fixes this issue + if sys.platform == "darwin" and getattr(sys, 'frozen', None) is None: + mac_dev_env = os.environ.copy() + # these are paths installed by brew or macports + yarn_path = "/usr/local/bin:/opt/local/bin:" + if yarn_path in mac_dev_env["PATH"]: + pass + else: + mac_dev_env["PATH"] = yarn_path + mac_dev_env["PATH"] + with open(os.devnull, 'w') as null: + return subprocess.Popen(command, cwd=cwd, stdout=null, env=mac_dev_env) + else: + with open(os.devnull, 'w') as null: + return subprocess.Popen(command, cwd=cwd, stdout=null) |
