From 6b74015b07805a8d03cdd26a7e0d3d3b08cd5951 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Fri, 1 May 2015 19:21:21 +0900 Subject: [PATCH] Call checkForPrerequesites Note: I only call this if --app-mode is on. That's not actually correct in that even if you run happyfuntimes without using --app-mode it still needs the prerequisites. I guess my thinking was currently they are only needed on linux and only if you install something from superhappyfuntimes. hmmm. maybe it should ways check? --- server/server.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/server/server.js b/server/server.js index ed46748c..7c06fb5c 100644 --- a/server/server.js +++ b/server/server.js @@ -101,6 +101,11 @@ function exitBecauseAlreadyRunning() { console.error("HappyFunTimes is already running"); } +function checkForPrerequisites() { + var platInfo = require('../lib/platform-info'); + return platInfo.checkForPrerequisites(); +} + function startServer() { if (args.appMode) { require('../lib/games').init(); @@ -131,7 +136,14 @@ function startServer() { var p; if (args.appMode || args.show) { var name = args.show || 'games'; - p = browser.launch('http://localhost:' + server.getSettings().port + '/' + name + '.html', config.getConfig().preferredBrowser); + p = checkForPrerequisites() + .catch(function(err) { + console.error(err); + process.exit(1); // eslint-disable-line + }) + .then(function() { + return browser.launch('http://localhost:' + server.getSettings().port + '/' + name + '.html', config.getConfig().preferredBrowser); + }); } else { p = Promise.resolve(); }