make sure asar ran successfully before renaming

Fixes #29
This commit is contained in:
Jacob Scherber 2020-07-24 20:32:29 -05:00 committed by GitHub
parent b5043508d9
commit 89d41fd08b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,8 +96,11 @@ try:
exit() exit()
if unpacking_asar: if unpacking_asar:
print(' ...unpacking app.asar') print(' ...unpacking app.asar')
subprocess.run(['asar', 'extract', os.path.join(filepath, 'app.asar'), os.path.join( result = subprocess.run(['asar', 'extract', os.path.join(filepath, 'app.asar'), os.path.join(
filepath, 'app')], shell=(True if sys.platform == 'win32' else False)) filepath, 'app')], shell=(True if sys.platform == 'win32' else False))
if result.returncode != 0:
print('> failed to find asar. install using \'npm install -g asar\'')
exit()
print(' ...renaming asar.app to asar.app.bak') print(' ...renaming asar.app to asar.app.bak')
os.rename(os.path.join(filepath, 'app.asar'), os.rename(os.path.join(filepath, 'app.asar'),
os.path.join(filepath, 'app.asar.bak')) os.path.join(filepath, 'app.asar.bak'))