+ linux binaries

* use paths based on OS
* minimal install
This commit is contained in:
Taegus
2018-12-22 16:36:49 +01:00
parent 3941ba7a3e
commit d7df361714
4 changed files with 38 additions and 7 deletions

View File

@@ -3,6 +3,8 @@ const {app, dialog} = require('electron');
const appRoot = require('app-root-path');
const path = require('path');
const fs = require('fs');
const os = require('os');
class Geth {
constructor() {
@@ -14,6 +16,22 @@ class Geth {
} else {
this.rootPath = appRoot.path;
}
switch(os.type()) {
case "Linux":
this.binaries = path.join(this.rootPath, 'bin', 'linux');
break;
case "Darwin":
this.binaries = path.join(this.rootPath, 'bin', 'macos');
break;
case "Windows_NT":
this.binaries = path.join(this.rootPath, 'bin', 'win');
break;
default:
this.binaries = path.join(this.rootPath, 'bin', 'win');
}
}
_writeLog(text) {
@@ -23,7 +41,7 @@ class Geth {
startGeth() {
// get the path of get and execute the child process
try {
const gethPath = path.join(path.join(this.rootPath, 'bin'), 'geth');
const gethPath = path.join(this.binaries, '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!");
@@ -42,8 +60,12 @@ class Geth {
}
stopGeth() {
const gethWrapePath = path.join(path.join(this.rootPath, 'bin'), 'WrapGeth.exe');
child_process.spawnSync(gethWrapePath, [this.gethProcess.pid]);
if (os.type() == "Windows_NT") {
const gethWrapePath = path.join(this.binaries, 'WrapGeth.exe');
child_process.spawnSync(gethWrapePath, [this.gethProcess.pid]);
} else {
this.gethProcess.kill('SIGTERM');
}
}
}