diff --git a/console/index.html b/console/index.html index 1d088cf01d..45205985ab 100644 --- a/console/index.html +++ b/console/index.html @@ -25,6 +25,7 @@ Settings + Open log directory diff --git a/console/index.js b/console/index.js index aa12a07370..8f6fa239f1 100755 --- a/console/index.js +++ b/console/index.js @@ -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); diff --git a/console/main.js b/console/main.js index 6655f8a15f..7cc0e6090a 100644 --- a/console/main.js +++ b/console/main.js @@ -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();