From 8ae4b487a2cd1a5a6772a41382c0922bfa042a6d Mon Sep 17 00:00:00 2001 From: Will Stamper Date: Fri, 2 Oct 2015 11:53:36 -0700 Subject: [PATCH 1/2] Allow searching for multiple strings at once --- lib/darwin/util.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/darwin/util.js b/lib/darwin/util.js index bd6c940..9cafad7 100644 --- a/lib/darwin/util.js +++ b/lib/darwin/util.js @@ -17,8 +17,19 @@ exports.parse = function( file, callback ) { } ); }; -exports.find = function( id, callback ) { - var pathQuery = 'mdfind "kMDItemCFBundleIdentifier=="' + id + '"" | head -1'; +exports.find = function( ids, callback ) { + var pathQuery = 'mdfind "'; + + if (!Array.isArray(ids)) { + ids = [ids]; + } + for (var i = 0; i < ids.length; i++) { + pathQuery += 'kMDItemCFBundleIdentifier=="' + ids[i] + '"'; + if (i !== ids.length - 1) { //when this isn't the last one + pathQuery += ' || '; + } + } + pathQuery += '" | head -1'; exec( pathQuery, function( err, stdout ) { var loc = stdout.trim(); From 54f21997641fe117339c022434f4495277d52df5 Mon Sep 17 00:00:00 2001 From: Will Stamper Date: Fri, 2 Oct 2015 11:54:50 -0700 Subject: [PATCH 2/2] Add support for Firefox Dev Edition on OSX --- lib/darwin/firefox.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/darwin/firefox.js b/lib/darwin/firefox.js index c4ce5ae..69436f2 100644 --- a/lib/darwin/firefox.js +++ b/lib/darwin/firefox.js @@ -11,7 +11,7 @@ exports.all = function( callback ) { } }; - util.find( 'org.mozilla.firefox', function( err, p ) { + util.find( ['org.mozilla.firefox', 'org.mozilla.firefoxdeveloperedition'], function( err, p ) { if ( p ) { var items = p.split( '\n' ); pending = items.length;