diff --git a/bin/linux/geth b/bin/linux/geth new file mode 100644 index 0000000..5daaf90 Binary files /dev/null and b/bin/linux/geth differ diff --git a/build_win.bat b/build_win.bat index de6d805..7e79e3e 100644 --- a/build_win.bat +++ b/build_win.bat @@ -3,6 +3,8 @@ ECHO Clean the cache first call npm cache clean --force ECHO Prune the project for production call npm prune --production +ECHO delete node modules +rmdir node_modules /S /Q ECHO Install all dependencies call npm install ECHO Make a distribution diff --git a/modules/geth.js b/modules/geth.js index 33b992a..e7ec1ca 100644 --- a/modules/geth.js +++ b/modules/geth.js @@ -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'); + } } } diff --git a/package.json b/package.json index ea23cf0..6e2b31a 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,10 @@ { "name": "Ether1Wallet", - "version": "0.1.2", + "version": "0.1.3", "description": "Desktop wallet for Ether1 currency", "main": "main.js", "scripts": { "start": "electron .", - "postinstall": "electron-builder", "pack": "build --dir", "dist": "build" }, @@ -14,9 +13,17 @@ "win": { "icon": "build/icon.png", "target": "7z", + "files": [ + "modules/*", + "assets/**/*", + "renderer/*", + "package.json", + "main.js", + "index.html" + ], "extraResources": [ - "bin/*" - ] + "bin/win/*" + ] } }, "repository": "https://github.com/taeguscromis/Ether1DesktopWallet",