From 29976747dfdd65ce72e240c590c457a83268f7de Mon Sep 17 00:00:00 2001 From: Shuai Date: Fri, 10 Apr 2020 13:38:28 +0800 Subject: [PATCH] pack mac --- neo3-gui/neo3-gui/ClientApp/node-manager.js | 20 +++++++++++++++++--- neo3-gui/neo3-gui/ClientApp/src/config.js | 8 +++----- neo3-gui/neo3-gui/neo3-gui.csproj | 2 +- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/neo3-gui/neo3-gui/ClientApp/node-manager.js b/neo3-gui/neo3-gui/ClientApp/node-manager.js index 958ecb7b..c540733c 100644 --- a/neo3-gui/neo3-gui/ClientApp/node-manager.js +++ b/neo3-gui/neo3-gui/ClientApp/node-manager.js @@ -1,6 +1,9 @@ const { spawn } = require('child_process'); const path = require('path'); - +const isMac = process.platform === "darwin"; +const isWin = process.platform === "win32"; +// const appPath = remote.app.getAppPath(); +// const isPack = remote.app.isPackaged; class NodeManager { @@ -24,9 +27,20 @@ class NodeManager { } runCommand(command, env) { - let startPath = __dirname.replace("app.asar", ""); + const startPath = __dirname.replace("app.asar", ""); console.log(startPath); - const ps = spawn(command, [], { shell: true, encoding: 'utf8', cwd: path.join(startPath, 'build-neo-node'), env }); + const parentEnv = process.env; + const childEnv = { ...parentEnv, ...env }; + if (isWin) { + + } + else if (isMac) { + childEnv.PATH = childEnv.PATH + ":/usr/local/share/dotnet"; + } + else { + + } + const ps = spawn(command, [], { shell: true, encoding: 'utf8', cwd: path.join(startPath, 'build-neo-node'), env: childEnv }); // ps.stdout.setEncoding('utf8'); ps.stdout.on('data', (data) => { // var str = iconv.decode(new Buffer(data), 'gbk') diff --git a/neo3-gui/neo3-gui/ClientApp/src/config.js b/neo3-gui/neo3-gui/ClientApp/src/config.js index dc177b5e..67f3adce 100644 --- a/neo3-gui/neo3-gui/ClientApp/src/config.js +++ b/neo3-gui/neo3-gui/ClientApp/src/config.js @@ -1,12 +1,10 @@ -class Config{ - +class Config { RPCURL = "http://localhost:8081"; - Language="en"; + Language = "en"; } -const config=new Config(); +const config = new Config(); -console.log("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn") export default config; \ No newline at end of file diff --git a/neo3-gui/neo3-gui/neo3-gui.csproj b/neo3-gui/neo3-gui/neo3-gui.csproj index 6c4a79a0..2df1d7ba 100644 --- a/neo3-gui/neo3-gui/neo3-gui.csproj +++ b/neo3-gui/neo3-gui/neo3-gui.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.0 + netcoreapp3.1 Neo ClientApp\ $(SpaRoot)node_modules\**;Data*\**