mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-08 23:12:16 +02:00
add initial local process search
This commit is contained in:
parent
a741208688
commit
c80e6f7da4
2 changed files with 63 additions and 9 deletions
|
@ -13,9 +13,9 @@ npm start
|
|||
|
||||
To run, the console needs to find a build of Interface, domain-server, and assignment-client.
|
||||
|
||||
The command `npm start` tells the console to look for debug builds of those binaries in a build folder beside this console folder.
|
||||
The command `npm start` tells the console to look for builds of those binaries in a build folder beside this console folder.
|
||||
|
||||
To look for release builds in the build folder, you'll want `npm run local-release`.
|
||||
On platforms with separate build folders for release and debug libraries `npm start` will choose the debug binaries. On those platforms if you prefer to use local release builds you'll want `npm run local-release`.
|
||||
|
||||
### Packaging
|
||||
|
||||
|
|
|
@ -24,25 +24,79 @@ var APP_ICON = 'resources/tray-icon.png';
|
|||
|
||||
// Quit when all windows are closed.
|
||||
app.on('window-all-closed', function() {
|
||||
<<<<<<< HEAD
|
||||
// On OS X it is common for applications and their menu bar
|
||||
// to stay active until the user quits explicitly with Cmd + Q
|
||||
if (process.platform != 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
=======
|
||||
// On OS X it is common for applications and their menu bar
|
||||
// to stay active until the user quits explicitly with Cmd + Q
|
||||
if (process.platform != 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
>>>>>>> add initial local process search
|
||||
});
|
||||
|
||||
// Check command line arguments to see how to find binaries
|
||||
var argv = require('yargs');
|
||||
var argv = require('yargs').argv;
|
||||
var fs = require('fs');
|
||||
|
||||
if (argv.localDebugBuilds) {
|
||||
// check in a dev folder structure for debug binaries
|
||||
} else if (argv.localReleaseBuilds) {
|
||||
// check in a dev folder structure for release binaries
|
||||
} else {
|
||||
// check beside the console application for the binaries
|
||||
function localProcessForBinary(name, preferRelease) {
|
||||
var path = "../build/" + name + "/";
|
||||
|
||||
function processFromPath(name, path) {
|
||||
function platformExtension() {
|
||||
return process.platform == 'win32' ? ".exe" : ""
|
||||
}
|
||||
|
||||
try {
|
||||
var fullPath = path + name + platformExtension();
|
||||
|
||||
var stats = fs.lstatSync(path + name + platformExtension())
|
||||
|
||||
if (stats.isFile()) {
|
||||
console.log("Found " + name + " at " + fullPath);
|
||||
return fullPath;
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Executable with name " + name + " not found at path " + path);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// does the executable exist at this path already?
|
||||
// if so assume we're on a platform that doesn't have Debug/Release
|
||||
// folders and just use the discovered executable
|
||||
var matchingProcess = processFromPath(name, path);
|
||||
|
||||
if (matchingProcess == null) {
|
||||
if (preferRelease) {
|
||||
// check if we can find the executable in a Release folder below this path
|
||||
matchingProcess = processFromPath(name, path + "Release/");
|
||||
} else {
|
||||
// check if we can find the executable in a Debug folder below this path
|
||||
matchingProcess = processFromPath(name, path + "Debug/");
|
||||
}
|
||||
}
|
||||
|
||||
return matchingProcess;
|
||||
}
|
||||
|
||||
|
||||
if (argv.localDebugBuilds) {
|
||||
// check in a dev folder structure for debug binaries
|
||||
var interfaceProcess = localProcessForBinary("Interface");
|
||||
var dsProcess = localProcessForBinary("domain-server");
|
||||
var acProcess = localProcessForBinary("assignment-client");
|
||||
} else if (argv.localReleaseBuilds) {
|
||||
// check in a dev folder structure for release binaries
|
||||
} else {
|
||||
// check beside the console application for the binaries
|
||||
}
|
||||
|
||||
// This method will be called when Electron has finished
|
||||
// initialization and is ready to create browser windows.
|
||||
app.on('ready', function() {
|
||||
|
|
Loading…
Reference in a new issue