First commit
This commit is contained in:
79
platforms/hybrid/launcher.js
Normal file
79
platforms/hybrid/launcher.js
Normal file
@@ -0,0 +1,79 @@
|
||||
console.log("the root directory is", process.cwd());
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
process.chdir('../../');
|
||||
|
||||
*/
|
||||
|
||||
require ( "./framework/server/index.js" );
|
||||
|
||||
var nw = require( "./node_modules/nw/index.js" );
|
||||
|
||||
var fs = require( "fs" );
|
||||
|
||||
console.log(nw);
|
||||
|
||||
var { exec } = require( 'node:child_process' );
|
||||
|
||||
|
||||
var nwPath = nw.findpath();
|
||||
|
||||
|
||||
if(process.platform == "win32") {
|
||||
|
||||
var split = nwPath.split("\\");
|
||||
|
||||
split.pop();
|
||||
|
||||
var path = split.join("\\");
|
||||
|
||||
path += "\\";
|
||||
|
||||
} else {
|
||||
|
||||
var split = nwPath.split("/");
|
||||
|
||||
split.pop();
|
||||
|
||||
var path = split.join("/");
|
||||
|
||||
path += "/";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
console.log(path);
|
||||
|
||||
var args = new Array(".", "--main", "http://localhost:3000/");
|
||||
|
||||
fs.copyFileSync("./package.json", path + "package.json")
|
||||
|
||||
|
||||
|
||||
var args = new Array(".", "--main", "http://localhost:3000/");
|
||||
|
||||
console.log("nw path", nw.findpath());
|
||||
|
||||
const ls = exec( nw.findpath(), args );
|
||||
|
||||
|
||||
/*
|
||||
ls.stdout.on('data', (data) => {
|
||||
console.log(`stdout: ${data}`);
|
||||
});
|
||||
|
||||
ls.stderr.on('data', (data) => {
|
||||
console.error(`stderr: ${data}`);
|
||||
});
|
||||
|
||||
ls.on('close', (code) => {
|
||||
console.log(`child process exited with code ${code}`);
|
||||
//process.exit(code);
|
||||
|
||||
});
|
||||
//taskkill /im node.exe
|
||||
console.log();*/
|
||||
Reference in New Issue
Block a user