Skip to content

Commit

Permalink
search more known paths for chrome on windows and mac
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 committed Jun 21, 2023
1 parent 2df16d4 commit 4b6a8a7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,18 @@ const getExecutablePath = () => {
}
}
} else if (process.platform === 'darwin') {
executablePath = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
executablePath = [
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
'/Applications/Chromium.app/Contents/MacOS/Chromium',
'/Applications/Brave Browser.app/Contents/MacOS/Brave Browser',
].find(fs.existsSync)
} else if (process.platform === 'win32') {
executablePath = 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe'
executablePath = [
`C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe`,
`C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe`,
path.join(process.env.USERPROFILE, 'AppData', 'Local', 'Google', 'Chrome', 'Application', 'chrome.exe'),
path.join(process.env.USERPROFILE, 'AppData', 'Local', 'Chromium', 'Application', 'chrome.exe'),
].find(fs.existsSync)
} else {
throw new Error('Unsupported platform: ' + process.platform)
}
Expand Down

0 comments on commit 4b6a8a7

Please sign in to comment.