diff options
| author | Lex Neva <github.com@lexneva.name> | 2019-04-11 00:03:23 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2019-04-11 00:03:23 -0400 |
| commit | d52dc8d5fc80fad645718805ebf6ec297ace8a44 (patch) | |
| tree | 3a82d8948c494d5bf86825184d5ae33b83e5f065 /lib/gui/electron.py | |
| parent | e06e63d44caeb72061a2e59e6efc40bee034d680 (diff) | |
fix electron path
Diffstat (limited to 'lib/gui/electron.py')
| -rw-r--r-- | lib/gui/electron.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/gui/electron.py b/lib/gui/electron.py index cad86a16..d3547c34 100644 --- a/lib/gui/electron.py +++ b/lib/gui/electron.py @@ -1,5 +1,6 @@ import os import subprocess +import sys from ..utils import get_bundled_dir @@ -10,7 +11,19 @@ app_process = None def open_url(url): global app - electron_path = os.path.join(get_bundled_dir("electron"), "out", "inkstitch-linux-x64", "inkstitch-gui") + if getattr(sys, 'frozen', None) is not None: + electron_path = os.path.join(get_bundled_dir("electron"), "inkstitch-gui") + else: + # It's a bit trickier to find the electron app in a development environment. + base_dir = get_bundled_dir("electron") + + try: + package_dir = os.listdir(os.path.join(base_dir, "out"))[0] + except (OSError, IndexError): + raise Exception("Electron app not found. Be sure to run 'npm install; npm run package' in %s." % base_dir) + + electron_path = os.path.join(base_dir, "out", package_dir, "inkstitch-gui") + app_process = subprocess.Popen([electron_path, url]) return app_process |
