fix: be more tolerant when detecting Android Studio IDE on OSX #252
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theutils.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.