diff --git a/package.json b/package.json index 53c6a784..20fcb96b 100644 --- a/package.json +++ b/package.json @@ -34,5 +34,8 @@ "grunt-contrib-sass": "~0.7.1", "grunt-contrib-watch": "~0.5.3", "grunt-contrib-compass": "~0.7.1" + }, + "scripts": { + "start": "node start.js" } } diff --git a/start.js b/start.js new file mode 100644 index 00000000..89a2e08a --- /dev/null +++ b/start.js @@ -0,0 +1,37 @@ +var path = require('path'); +var child_process = require('child_process'); + +var exeNames = { + windows: 'nw.exe', + linux: 'nw', + mac: '' +}; +var osName = getOperatingSystem(); +if(osName == 'windows' || osName == 'linux') { + var exePath = path.join(__dirname, 'node-webkit', osName, exeNames[osName]); + var child = child_process.spawn(exePath, [__dirname, '--debug'], { + cwd: __dirname, + detached: true, + stdio: 'ignore' + }); + child.unref(); +} +// Mac not supported yet. I don't know how to start a .app directory. +// If someone else does, feel free to add it + + +function getOperatingSystem() { + var os = require('os'); + var platform = os.platform(); + + if( platform == 'win32' || platform == 'win64' ) { + return 'windows'; + } + if( platform == 'darwin' ) { + return 'mac'; + } + if( platform == 'linux' ) { + return 'linux'; + } + return null; +}