Files
Unify/platforms/hybrid/launcher.js
2025-12-25 11:16:59 +01:00

79 lines
1.2 KiB
JavaScript

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();*/