forked from HDNua/JSCC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
33 lines (27 loc) · 759 Bytes
/
main.js
File metadata and controls
33 lines (27 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// get child_process module.
var childproc = require('child_process');
// get os module.
var os = require('os');
// get os.platform()
var platform = os.platform();
console.log(platform);
// set nwjs binary name by platform
var execName = 'nw';
switch (platform) {
case 'win32': // win32 or win64
execName = 'nw';
break;
case 'linux':
execName = 'nw';
break;
case 'darwin': // Mac OS X
execName = 'nw';
break;
}
var execArgv = ['app.zip', __dirname, platform];
// start process using child_process
// with current path string
// '__dirname' would be not only path
// of 'main.js' but also one of 'app.zip'
// because 'main.js' and 'app.zip' have same directory
childproc.exec(execName + ' ' + execArgv.join(' '));