Skip to content

Commit c2527c6

Browse files
rchlpimlie
authored andcommitted
fix(detection): Chrome detection fails on MacOs Catalina (#30)
* fix(detection): Chrome detection fails on MacOs Catalina In Catalina lines returned by OS have a suffix with some hex code in parenthesis. For example: path: /Applications/Google Chrome.app (0x1ae4) path: /Users/rchlodnicki/Downloads/Google Chrome.app (0xa8c) Fixed by parsing lines with regexp and ignoring that part of the line. Switched from `awk` to JS for that job as it's more flexible and easier. Resolves #29 * filter out some unwanted results * Simplify based on @clarkdo fix * Readd trim()
1 parent 030631f commit c2527c6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/utils/detectors/chrome.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ export default class ChromeDetector {
4444
if (customChromePath) {
4545
installations.push(customChromePath)
4646
}
47-
execSync(
48-
`${LSREGISTER} -dump` +
49-
' | grep -E -i \'(google chrome( canary)?|chromium).app$\'' +
50-
' | awk \'{$1=""; print $0}\''
51-
)
47+
execSync(`
48+
${LSREGISTER} -dump
49+
| grep -E -i -o '/.+(google chrome( canary)?|chromium)\\.app(\\s|$)'
50+
| grep -E -v 'Caches|TimeMachine|Temporary|/Volumes|\\.Trash'
51+
`)
5252
.toString()
5353
.split(newLineRegex)
5454
.forEach((inst) => {

0 commit comments

Comments
 (0)