From d71fa27db65d2f58da847e8960aab2109a48f115 Mon Sep 17 00:00:00 2001 From: Mitchell Hentges Date: Mon, 29 Feb 2016 16:48:36 +0100 Subject: [PATCH] chromium should use `util` --- lib/darwin/chromium.js | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/lib/darwin/chromium.js b/lib/darwin/chromium.js index 4ad75d1..9cac216 100644 --- a/lib/darwin/chromium.js +++ b/lib/darwin/chromium.js @@ -1,32 +1,6 @@ var util = require('./util'), - currentPath; + CHROMIUM_ID = 'org.chromium.Chromium', + CHROMIUM_VERSION = 'CFBundleShortVersionString'; -function getPath(callback) { - if (currentPath) { - return callback(null, currentPath); - } - - util.find('org.chromium.Chromium', function (err, path) { - currentPath = path; - callback(err, currentPath); - }); -} - -function getVersion(callback) { - getPath(function (err, path) { - if (err) { - return callback(err, null); - } - - util.parse(util.getInfoPath(path), function (err, data) { - if (err) { - return callback(err, null); - } - - callback(null, data['CFBundleShortVersionString']); - }); - }); -} - -exports.path = getPath; -exports.version = getVersion; +exports.path = util.find.bind(null, CHROMIUM_ID); +exports.version = util.getInfoKey.bind(null, CHROMIUM_ID, CHROMIUM_VERSION);