Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit and then document chrome-finder paths #262

Open
connorjclark opened this issue Mar 15, 2022 · 0 comments
Open

Audit and then document chrome-finder paths #262

connorjclark opened this issue Mar 15, 2022 · 0 comments

Comments

@connorjclark
Copy link
Collaborator

connorjclark commented Mar 15, 2022

This is how it works today:

Manually provided chrome location:

(linux) Look for any installation in these desktop folders (recursively), adding all found:

  • ~/.local/share/applications/
  • /usr/share/applications/

(windows) Look for installations:

  1. Google/Chrome SxS/Application/chrome.exe
  2. Google/Chrome/Application/chrome.exe

in these folders:

  • process.env.LOCALAPPDATA
  • process.env.PROGRAMFILES
  • process.env['PROGRAMFILES(X86)']

Note: the order is: first folder;Chrome SxS;Chrome;second folder; ...

  • (linux) which for:
    google-chrome-stable
    google-chrome
    chromium-browser
    chromium

(linux) Do a sorting pass. Because previous steps searched a folder, they need to be sorted by our preference:

  • (the manually provided location comes first)
  • chrome-wrapper
  • google-chrome-stable
  • google-chrome
  • chromium-browser
  • chromium

(mac) Do a sorting pass. Unlike linux, this sorts primarily by installation folder:

  • ~/Applications/.*Chrome.app
  • ~/Applications/.*Chrome Canary.app
  • /Applications/.*Chrome.app
  • /Applications/.*Chrome Canary.app
  • /Volumes/.*Chrome.app/
  • /Volumes/.*Chrome Canary.app/

Note: there is a "fast mac" path. Looks like for mac, we always just do:

  • CHROME_PATH
  • LIGHTHOUSE_CHROMIUM_PATH
  • /Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary
  • /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

The full search treatment for mac only happens for getInstallations, which is not called by our launcher.


Some things we could change:

  • getFirstInstallation does the fast mac path, but does not fall back to slow path if none found
  • We could provide a similar fast path for each OS
  • for lsregister usage, check for duplicates before reading filesystem (minor perf improvement)
  • which -a (unix) and where (windows) exist for finding all things on PATH
  • drop LIGHTHOUSE_CHROMIUM_PATH (it is deprecated)
  • Some of the sorting seems inconsistent

Worth noting that in practice, only the first installation ever matters, but I can imagine that finding all installations on a machine is a useful feature to someone so let's keep it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant