2019-04-11 03:37:16 +00:00
|
|
|
import os
|
|
|
|
import subprocess
|
2019-04-11 04:03:23 +00:00
|
|
|
import sys
|
2019-04-11 03:37:16 +00:00
|
|
|
|
|
|
|
from ..utils import get_bundled_dir
|
|
|
|
|
|
|
|
|
|
|
|
app_process = None
|
|
|
|
|
|
|
|
|
|
|
|
def open_url(url):
|
|
|
|
global app
|
|
|
|
|
2019-04-11 04:03:23 +00:00
|
|
|
if getattr(sys, 'frozen', None) is not None:
|
|
|
|
electron_path = os.path.join(get_bundled_dir("electron"), "inkstitch-gui")
|
|
|
|
|
2019-04-12 21:45:57 +00:00
|
|
|
if sys.platform == "darwin":
|
|
|
|
electron_path += ".app/Contents/MacOS/inkstitch-gui"
|
|
|
|
subprocess.Popen(["open", "-a", electron_path, "--args", url])
|
|
|
|
else:
|
|
|
|
app_process = subprocess.Popen([electron_path, url])
|
2019-04-11 05:00:28 +00:00
|
|
|
else:
|
2019-04-12 21:45:57 +00:00
|
|
|
# if we're not running in a pyinstaller bundle, run electron directly
|
|
|
|
app_process = subprocess.Popen(["yarn", "dev", url], cwd=get_bundled_dir("electron"))
|
2019-04-11 03:37:16 +00:00
|
|
|
|
|
|
|
return app_process
|