diff --git a/app/assets/js/assetguard.js b/app/assets/js/assetguard.js index 4b3f0a1..97eeda5 100644 --- a/app/assets/js/assetguard.js +++ b/app/assets/js/assetguard.js @@ -28,6 +28,7 @@ const child_process = require('child_process') const crypto = require('crypto') const EventEmitter = require('events') const fs = require('fs') +const isDev = require('electron-is-dev') const mkpath = require('mkdirp'); const path = require('path') const Registry = require('winreg') @@ -464,7 +465,17 @@ class AssetGuard extends EventEmitter { */ static _extractPackXZ(filePaths, javaExecutable){ return new Promise(function(fulfill, reject){ - const libPath = path.join(__dirname, '..', 'libraries', 'java', 'PackXZExtract.jar') + let libPath + if(isDev){ + libPath = path.join(process.cwd(), 'libraries', 'java', 'PackXZExtract.jar') + } else { + if(process.platform === 'darwin'){ + libPath = path.join(process.cwd(),'Contents', 'Resources', 'libraries', 'java', 'PackXZExtract.jar') + } else { + libPath = path.join(process.cwd(), 'resources', 'libraries', 'java', 'PackXZExtract.jar') + } + } + const filePath = filePaths.join(',') const child = child_process.spawn(javaExecutable, ['-jar', libPath, '-packxz', filePath]) child.stdout.on('data', (data) => { diff --git a/app/assets/js/scripts/uicore.js b/app/assets/js/scripts/uicore.js index 1e41c5f..2e2ae1c 100644 --- a/app/assets/js/scripts/uicore.js +++ b/app/assets/js/scripts/uicore.js @@ -50,8 +50,10 @@ if(!isDev){ case 'error': console.log('Error during update check..') console.debug('Error Code:', info != null ? info.code : null) - if(err.code === 'ERR_UPDATER_INVALID_RELEASE_FEED'){ - console.log('No suitable releases found.') + if(err != null && err.code != null){ + if(err.code === 'ERR_UPDATER_INVALID_RELEASE_FEED'){ + console.log('No suitable releases found.') + } } break default: diff --git a/app/assets/libraries/java/PackXZExtract.jar b/libraries/java/PackXZExtract.jar similarity index 100% rename from app/assets/libraries/java/PackXZExtract.jar rename to libraries/java/PackXZExtract.jar diff --git a/package.json b/package.json index 50f332f..6f9a076 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,9 @@ "files": [ "!{target,logs,.vscode,docs,dev-app-update.yml}" ], + "extraResources": [ + "libraries" + ], "asar": true } }