tabrindle / envinfo

Generate a report about your development environment for debugging and issue reporting
MIT License
760 stars 58 forks source link

fix: be more tolerant when detecting Android Studio IDE on OSX #252

Closed Nthalk closed 6 months ago

Nthalk commented 7 months ago

The Android Studio location on OSX uses non universal locations, "/Applications" for Android Studio installed standalone (or modern Jetbrains Toolbox), and a "~/Applications/JetBrains Toolbox/" for JetBrains toolbox installs (which mine did not install into).

Using the standard installers, I've ended up with my Toolbox in "/Applications" and my Android Studio in "~/Applications", which is the exact opposite of what ides.js expects. I'm not sure if I'm rocking a more modern setup (on my new-ish M1), but I do think we should try our best to support this variation.

This PR addresses this by detecting the first of four paths that resolve:

"/Applications/Android Studio.app" "$HOME/Applications/Android Studio.app" "/Applications/JetBrains Toolbox/Android Studio.app" "$HOME/Applications/JetBrains Toolbox/Android Studio.app"

However, this requires removing the escaping, as utils.fileExists performs double escaping, yet the utils.generatePlistBuddyCommand requires it, so escaping was placed after dir resolution, and before command generation.

This CAN fail, if a user's home directory has characters in it that require escaping, but... Wow, I mean those people are probably used to headaches.

matej-podzemny commented 6 months ago

Yes! BIG APPROVE! 🚀 we need this one to get into production ASAP

Nthalk commented 6 months ago

@gengjiawen ?

gengjiawen commented 6 months ago

Thx.