! correctly get root path always

* moved binaries to the correct spot
This commit is contained in:
Taegus
2018-12-22 11:55:09 +01:00
parent 3af97f81ba
commit 1b68160a98
2 changed files with 13 additions and 4 deletions

View File

@@ -8,6 +8,12 @@ class Geth {
constructor() { constructor() {
this.gethProcess = null; this.gethProcess = null;
this.logStream = fs.createWriteStream(path.join(app.getPath('userData'), 'gethlog.txt')); this.logStream = fs.createWriteStream(path.join(app.getPath('userData'), 'gethlog.txt'));
if (appRoot.path.indexOf('app.asar') > -1) {
this.rootPath = path.dirname(appRoot.path);
} else {
this.rootPath = appRoot.path;
}
} }
_writeLog(text) { _writeLog(text) {
@@ -17,7 +23,7 @@ class Geth {
startGeth() { startGeth() {
// get the path of get and execute the child process // get the path of get and execute the child process
try { try {
const gethPath = path.join(path.join(appRoot.path, 'bin'), 'geth'); const gethPath = path.join(path.join(this.rootPath, '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 = 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) { this.gethProcess.on('error', function(err) {
dialog.showErrorBox("Error starting application", "Geth failed to start!"); dialog.showErrorBox("Error starting application", "Geth failed to start!");
@@ -36,7 +42,7 @@ class Geth {
} }
stopGeth() { stopGeth() {
const gethWrapePath = path.join(path.join(appRoot.path, 'bin'), 'WrapGeth.exe'); const gethWrapePath = path.join(path.join(this.rootPath, 'bin'), 'WrapGeth.exe');
child_process.spawnSync(gethWrapePath, [this.gethProcess.pid]); child_process.spawnSync(gethWrapePath, [this.gethProcess.pid]);
} }
} }

View File

@@ -13,7 +13,10 @@
"appId": "Ether1DesktopWallet", "appId": "Ether1DesktopWallet",
"win": { "win": {
"icon": "build/icon.png", "icon": "build/icon.png",
"target": "7z" "target": "7z",
"extraResources": [
"bin/*"
]
} }
}, },
"repository": "https://github.com/taeguscromis/Ether1DesktopWallet", "repository": "https://github.com/taeguscromis/Ether1DesktopWallet",
@@ -29,7 +32,7 @@
"app-root-path": "^2.1.0", "app-root-path": "^2.1.0",
"electron-storage": "^1.0.7", "electron-storage": "^1.0.7",
"handlebars": "^4.0.12", "handlebars": "^4.0.12",
"nedb": "^1.8.0", "nedb": "^1.8.0"
}, },
"devDependencies": { "devDependencies": {
"electron": "^3.0.12", "electron": "^3.0.12",