From acb2be4ac62558778b57701ff11b31ff826dbf12 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Fri, 1 May 2015 19:20:57 +0900 Subject: [PATCH] add checkPrerequisites for platforms --- lib/platform-info.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/platform-info.js b/lib/platform-info.js index 526997f1..68127f88 100644 --- a/lib/platform-info.js +++ b/lib/platform-info.js @@ -31,7 +31,20 @@ "use strict"; var fs = require('fs'); +var Promise = require('promise'); var strings = require('./strings'); +var utils = require('./utils'); + +var execP = Promise.denodeify(utils.execute); + +function checkInstalledLinux(pkg) { + return execP("dpkg", ["-s", pkg]).then(function(result) { + return Promise.resolve(); + }).catch(function() { + var msg = "missing package: " + pkg + ". Please install it"; + return Promise.reject(msg); + }); +} module.exports = (function() { var p = process.platform.toLowerCase(); @@ -51,6 +64,9 @@ module.exports = (function() { } } }()), + checkForPrerequisites: function() { + return Promise.resolve(); + }, }; } else if (p === 'darwin') { return { @@ -59,12 +75,21 @@ module.exports = (function() { exePath: "bin/%(gameId)s-osx.app/Contents/MacOS/%(gameId)s-osx", launcher: "open", exporterPath: "/Applications/Unity/Unity.app/Contents/MacOS/Unity", + checkForPrerequisites: function() { + return Promise.resolve(); + }, }; } else { return { id: "linux", exePath: "bin/%(gameId)s-linux.x86", exeSuffix: "-linux.x86", + checkForPrerequisites: function() { + return checkInstalledLinux("zenity") + .then(function() { + return checkInstalledLinux("wmctrl"); + }); + }, }; } }());