Skip to content

Commit

Permalink
add checkPrerequisites for platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed May 1, 2015
1 parent 11f59a2 commit acb2be4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/platform-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -51,6 +64,9 @@ module.exports = (function() {
}
}
}()),
checkForPrerequisites: function() {
return Promise.resolve();
},
};
} else if (p === 'darwin') {
return {
Expand All @@ -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");
});
},
};
}
}());
Expand Down

0 comments on commit acb2be4

Please sign in to comment.