mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 18:16:08 +02:00
Add log opening to console
This commit is contained in:
parent
b907a04a3f
commit
5bdea485fc
3 changed files with 24 additions and 6 deletions
|
@ -25,6 +25,7 @@
|
|||
<button class="power-on">Turn On</button>
|
||||
<button class="power-off">Turn Off</button>
|
||||
<a href="http://localhost:40100/" target="_blank">Settings</a>
|
||||
<a id="open-logs" href="#">Open log directory</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -31,6 +31,9 @@ ready = function() {
|
|||
$('#server .power-off').click(function() {
|
||||
ipcRenderer.send('stop-server', { name: 'home' });
|
||||
});
|
||||
$('#open-logs').click(function() {
|
||||
ipcRenderer.send('open-logs');
|
||||
});
|
||||
|
||||
ipcRenderer.on('process-update', onProcessUpdate);
|
||||
|
||||
|
|
|
@ -6,6 +6,9 @@ var BrowserWindow = require('browser-window'); // Module to create native brows
|
|||
var Menu = require('menu');
|
||||
var Tray = require('tray');
|
||||
var shell = require('shell');
|
||||
var os = require('os');
|
||||
var childProcess = require('child_process');
|
||||
var path = require('path');
|
||||
|
||||
var hfprocess = require('./modules/hf-process.js');
|
||||
var Process = hfprocess.Process;
|
||||
|
@ -43,6 +46,17 @@ if (argv.localDebugBuilds || argv.localReleaseBuilds) {
|
|||
acPath = pathFinder.discoveredPath("assignment-client", argv.localReleaseBuilds);
|
||||
}
|
||||
|
||||
function openFileBrowser(path) {
|
||||
var type = os.type();
|
||||
if (type == "Windows_NT") {
|
||||
childProcess.exec('start ' + path);
|
||||
} else if (type == "Darwin") {
|
||||
childProcess.exec('open ' + path);
|
||||
} else if (type == "Linux") {
|
||||
childProcess.exec('xdg-open ' + path);
|
||||
}
|
||||
}
|
||||
|
||||
// if at this point any of the paths are null, we're missing something we wanted to find
|
||||
// TODO: show an error for the binaries that couldn't be found
|
||||
|
||||
|
@ -82,17 +96,14 @@ app.on('ready', function() {
|
|||
shell.openExternal(url);
|
||||
});
|
||||
|
||||
var logPath = path.join(app.getAppPath(), 'logs');
|
||||
|
||||
if (interfacePath && dsPath && acPath) {
|
||||
var pInterface = new Process('interface', interfacePath);
|
||||
|
||||
var homeServer = new ProcessGroup('home', [
|
||||
new Process('domain_server', dsPath),
|
||||
new Process('ac_audio', acPath, ['-t0']),
|
||||
new Process('ac_avatar', acPath, ['-t1']),
|
||||
new Process('ac_agent', acPath, ['-t2']),
|
||||
new Process('ac_asset', acPath, ['-t3']),
|
||||
new Process('ac_messages', acPath, ['-t4']),
|
||||
new Process('ac_entity', acPath, ['-t6'])
|
||||
new Process('ac_monitor', acPath, ['-n6', '--log-directory', logPath])
|
||||
]);
|
||||
homeServer.start();
|
||||
|
||||
|
@ -125,6 +136,9 @@ app.on('ready', function() {
|
|||
homeServer.stop();
|
||||
sendProcessUpdate();
|
||||
});
|
||||
ipcMain.on('open-logs', function(event, arg) {
|
||||
openFileBrowser(logPath);
|
||||
});
|
||||
ipcMain.on('update', sendProcessUpdate);
|
||||
|
||||
sendProcessUpdate();
|
||||
|
|
Loading…
Reference in a new issue