Make js2asar.py more robust
This commit is contained in:
parent
d49302858b
commit
161bd89a24
1 changed files with 3 additions and 15 deletions
|
@ -29,22 +29,10 @@ def copy_files(source_files, output_dir):
|
||||||
|
|
||||||
|
|
||||||
def call_asar(archive, output_dir):
|
def call_asar(archive, output_dir):
|
||||||
asar = os.path.join(SOURCE_ROOT, 'node_modules', 'asar', 'bin', 'asar')
|
asar = os.path.join(SOURCE_ROOT, 'node_modules', '.bin', 'asar')
|
||||||
subprocess.check_call([find_node(), asar, 'pack', output_dir, archive])
|
|
||||||
|
|
||||||
|
|
||||||
def find_node():
|
|
||||||
WINDOWS_NODE_PATHs = [
|
|
||||||
'C:/Program Files (x86)/nodejs',
|
|
||||||
'C:/Program Files/nodejs',
|
|
||||||
] + os.environ['PATH'].split(os.pathsep)
|
|
||||||
|
|
||||||
if sys.platform in ['win32', 'cygwin']:
|
if sys.platform in ['win32', 'cygwin']:
|
||||||
for path in WINDOWS_NODE_PATHs:
|
asar += '.cmd'
|
||||||
full_path = os.path.join(path, 'node.exe')
|
subprocess.check_call([asar, 'pack', output_dir, archive])
|
||||||
if os.path.exists(full_path):
|
|
||||||
return full_path
|
|
||||||
return 'node'
|
|
||||||
|
|
||||||
|
|
||||||
def safe_mkdir(path):
|
def safe_mkdir(path):
|
||||||
|
|
Loading…
Reference in a new issue