diff --git a/modules/geth.js b/modules/geth.js index 70eb717..7653f27 100644 --- a/modules/geth.js +++ b/modules/geth.js @@ -1,5 +1,6 @@ const child_process = require('child_process'); const {app, dialog} = require('electron'); +const appRoot = require('app-root-path'); const path = require('path'); const fs = require('fs'); @@ -16,7 +17,7 @@ class Geth { startGeth() { // get the path of get and execute the child process try { - const gethPath = path.join(app.getPath('userData'), 'geth'); + const gethPath = path.join(path.join(appRoot.path, 'bin'), 'geth'); this.gethProcess = child_process.spawn(gethPath, ['--ws', '--wsorigins', '*', '--wsaddr', '127.0.0.1', '--wsport', '8546', '--wsapi', 'admin,db,eth,net,miner,personal,web3']); this.gethProcess.on('error', function(err) { dialog.showErrorBox("Error starting application", "Geth failed to start!"); @@ -35,7 +36,7 @@ class Geth { } stopGeth() { - const gethWrapePath = path.join(app.getPath('userData'), 'WrapGeth.exe'); + const gethWrapePath = path.join(path.join(appRoot.path, 'bin'), 'WrapGeth.exe'); child_process.spawnSync(gethWrapePath, [this.gethProcess.pid]); } } diff --git a/package.json b/package.json index 67e1eda..f62833d 100644 --- a/package.json +++ b/package.json @@ -26,10 +26,10 @@ "license": "CC0-1.0", "dependencies": { "adm-zip": "^0.4.13", + "app-root-path": "^2.1.0", "electron-storage": "^1.0.7", "handlebars": "^4.0.12", "nedb": "^1.8.0", - "typescript": "^3.2.2" }, "devDependencies": { "electron": "^3.0.12",