From 6377ee30adb122d0510da594e9b451574c1520f0 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Wed, 17 Jul 2019 16:29:52 +0900 Subject: [PATCH] fix: Look for other paths for Firefox Nightly on Windows and Mac More recent installs of Firefox Nightly on Windows use "Firefox Nightly" instead of "Nightly" for the application folder. Apparently OSX uses "Firefox Nightly" instead of "FirefoxNightly" too. --- index.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) mode change 100644 => 100755 index.js diff --git a/index.js b/index.js old mode 100644 new mode 100755 index da35502..0c8da9f --- a/index.js +++ b/index.js @@ -52,18 +52,18 @@ var getFirefoxExe = function (firefoxDirName) { return null } - var prefix - var prefixes = getAllPrefixes() - var suffix = '\\' + firefoxDirName + '\\firefox.exe' + var firefoxDirNames = Array.prototype.slice.call(arguments) - for (var i = 0; i < prefixes.length; i++) { - prefix = prefixes[i] - if (fs.existsSync(prefix + suffix)) { - return prefix + suffix + for (var prefix of getAllPrefixes()) { + for (var dir of firefoxDirNames) { + var candidate = path.join(prefix, dir, 'firefox.exe') + if (fs.existsSync(candidate)) { + return candidate + } } } - return 'C:\\Program Files' + suffix + return path.join('C:\\Program Files', firefoxDirNames[0], 'firefox.exe') } var getFirefoxWithFallbackOnOSX = function () { @@ -213,8 +213,8 @@ FirefoxNightlyBrowser.prototype = { DEFAULT_CMD: { linux: 'firefox', - darwin: getFirefoxWithFallbackOnOSX('FirefoxNightly'), - win32: getFirefoxExe('Nightly') + darwin: getFirefoxWithFallbackOnOSX('FirefoxNightly', 'Firefox Nightly'), + win32: getFirefoxExe('Nightly', 'Firefox Nightly') }, ENV_CMD: 'FIREFOX_NIGHTLY_BIN' }