-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathlinux.js
More file actions
42 lines (33 loc) · 940 Bytes
/
linux.js
File metadata and controls
42 lines (33 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var which = require('which');
function getBin(commands) {
// Don't run these checks if not on linux
if (process.platform !== 'linux') {
return null;
}
// Check each command separately
let path = null;
for (let i = 0; i < commands.length; i++) {
path = which.sync(commands[i], {nothrow: true});
if (path) return path;
}
return null;
}
function getChrome() {
return getBin(['google-chrome', 'google-chrome-stable']);
}
function getEdge() {
return getBin(['microsoft-edge-stable']);
}
function getThorium() {
return getBin(['thorium-browser']);
}
function getChromium() {
return getBin(['chromium-browser', 'chromium']) || getChrome() || getEdge() || getThorium() || getBrave();
}
function getBrave() {
return getBin(['brave-browser', 'brave-browser-stable', 'brave']);
}
function getFirefox() {
return getBin(['firefox']);
}
module.exports = { getChrome, getEdge, getThorium, getBrave, getChromium, getFirefox };