diff options
| author | rejbasket <39080670+rejbasket@users.noreply.github.com> | 2021-12-08 22:18:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-08 22:18:41 +0100 |
| commit | 41ace3a9e53b52b4271554d7aedd88d533ee5f5e (patch) | |
| tree | 83dd3887459eeb79c95177bf318598ee01514fa1 /lib/gui/electron.py | |
| parent | 49d0f88278798a6c061ce70dd6c1aafb0b1f7a6a (diff) | |
add macOS and windows installer (#1352)
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) |
