windows compat fix in android binary finding logic (attempt to fix #1759)

This commit is contained in:
Jonathan Lipps
2014-01-16 12:21:26 -08:00
parent 8334ef5e65
commit 7b19a0e12d

View File

@@ -55,6 +55,7 @@ ADB.prototype.checkSdkBinaryPresent = function(binary, cb) {
logger.info("Checking whether " + binary + " is present");
var binaryLoc = null;
var binaryName = binary;
var cmd = "which";
if (isWindows) {
if (binaryName === "android") {
binaryName += ".bat";
@@ -63,6 +64,7 @@ ADB.prototype.checkSdkBinaryPresent = function(binary, cb) {
binaryName += ".exe";
}
}
cmd = "where";
}
if (this.sdkRoot) {
var binaryLocs = [ path.resolve(this.sdkRoot, "platform-tools", binaryName)
@@ -88,7 +90,7 @@ ADB.prototype.checkSdkBinaryPresent = function(binary, cb) {
this.binaries[binary] = binaryLoc;
cb(null, binaryLoc);
} else {
exec("which " + binary, { maxBuffer: 524288 }, function(err, stdout) {
exec(cmd + " " + binary, { maxBuffer: 524288 }, function(err, stdout) {
if (stdout) {
this.debug("Using " + binary + " from " + stdout);
cb(null, stdout);