blob: d3547c3425a27fb803008dc791d515b0f58dd2c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import os
import subprocess
import sys
from ..utils import get_bundled_dir
app_process = None
def open_url(url):
global app
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
|