Skip to content

Commit

Permalink
fix: Bypass WSL check if Firefox is present in WSL environment
Browse files Browse the repository at this point in the history
Fixes #107.
  • Loading branch information
tstackhouse authored and birtles committed Jan 28, 2020
1 parent 234bb50 commit 23a5d10
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var fs = require('fs')
var path = require('path')
var isWsl = require('is-wsl')
var which = require('which')
var { execSync } = require('child_process')
var { StringDecoder } = require('string_decoder')

Expand All @@ -18,6 +19,11 @@ var PREFS = [
'user_pref("extensions.enabledScopes", 15);'
].join('\n')

// Check if Firefox is installed on the WSL side and use that if it's available
if (isWsl && which.sync('firefox', { nothrow: true })) {
isWsl = false
}

// Get all possible Program Files folders even on other drives
// inspect the user's path to find other drives that may contain Program Files folders
var getAllPrefixes = function () {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"Žilvinas Urbonas <[email protected]>"
],
"dependencies": {
"is-wsl": "^2.1.1"
"is-wsl": "^2.1.1",
"which": "^2.0.1"
}
}
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3191,6 +3191,13 @@ which@^1.2.9:
dependencies:
isexe "^2.0.0"

which@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/which/-/which-2.0.1.tgz#f1cf94d07a8e571b6ff006aeb91d0300c47ef0a4"
integrity sha512-N7GBZOTswtB9lkQBZA4+zAXrjEIWAUOB93AvzUiudRzRxhUdLURQ7D/gAIMY1gatT/LTbmbcv8SiYazy3eYB7w==
dependencies:
isexe "^2.0.0"

[email protected]:
version "1.1.3"
resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457"
Expand Down

0 comments on commit 23a5d10

Please sign in to comment.