Skip to content

Commit

Permalink
Firefox can use util
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitchell Hentges committed Feb 29, 2016
1 parent c59c7ea commit 79fb2f5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 72 deletions.
35 changes: 0 additions & 35 deletions lib/darwin/firefox.js

This file was deleted.

2 changes: 1 addition & 1 deletion lib/darwin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function browser(id, versionKey) {
}

exports.safari = browser('com.apple.Safari', 'CFBundleShortVersionString');
exports.firefox = require( './firefox' );
exports.firefox = browser('org.mozilla.firefox', 'CFBundleShortVersionString');
exports.chrome = exports[ 'google-chrome' ] = browser('com.google.Chrome', 'KSVersion');
exports.chromium = browser('org.chromium.Chromium', 'CFBundleShortVersionString');
exports.canary = exports[ 'chrome-canary' ] = exports[ 'google-chrome-canary' ] = browser('com.google.Chrome.canary', 'KSVersion');
Expand Down
53 changes: 17 additions & 36 deletions lib/detect.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,29 +92,19 @@ function detectWindows( callback ) {
*/
function checkDarwin( name, callback ) {
if ( darwin[ name ] ) {
if ( darwin[ name ].all ) {
darwin[ name ].all( function( err, available ) {
if ( err ) {
callback( 'failed to get version for ' + name );
} else {
callback( err, available );
}
} );
} else {
darwin[ name ].version( function( err, version ) {
if ( version ) {
darwin[ name ].path( function( err, p ) {
if ( err ) {
return callback( 'failed to get path for ' + name );
}

callback( null, version, p );
} );
} else {
callback( 'failed to get version for ' + name );
}
} );
}
darwin[ name ].version( function( err, version ) {
if ( version ) {
darwin[ name ].path( function( err, p ) {
if ( err ) {
return callback( 'failed to get path for ' + name );
}

callback( null, version, p );
} );
} else {
callback( 'failed to get version for ' + name );
}
} );
} else {
checkOthers( name, callback );
}
Expand Down Expand Up @@ -190,19 +180,10 @@ module.exports = function detect( callback ) {

check( name, function( err, v, p ) {
if ( err === null ) {
if ( Array.isArray( v ) ) {
v.forEach( function( item ) {
available.push( extend( {}, br, {
command: item.path,
version: item.version
} ) );
} );
} else {
available.push( extend( {}, br, {
command: p || name,
version: v
} ) );
}
available.push( extend( {}, br, {
command: p || name,
version: v
} ) );
}

next();
Expand Down

0 comments on commit 79fb2f5

Please sign in to comment.