unity-patch icon indicating copy to clipboard operation
unity-patch copied to clipboard

[Enhancement] Check for alternate install path defined in Unity Hub

Open maximilianmaihoefner opened this issue 5 years ago • 1 comments

Using Unity Hub it is easy to define an alternate install path for the Unity Editors. After some digging I found that Unity Hub stores that alternate install path in a file called secondaryInstallPath.json. On macOS it is located in ~/Library/Application Support/UnityHub (no clue about Windows or Linux). The file content, although named .json, is just a string:

"/Applications/CustomUnityDirectory/Editors"

To make it even easier for people to use the Patcher we could read that file and check for Unity Editors in that location in addition to the default one.

Right now the Patcher is quite optimistic when scanning the installation Directory and assumes all sub-directories are Unity Editors, this most likely will break if checking the alternate install paths, since people might just define /Applications or C:\Programm Files.

So the Todos would be:

  1. Figure out where the secondaryInstallPath.json file is located on Windows and Linux.
  2. Add Code to read the file and check that location for Unity Editors.
  3. Add Code to detect if a directory contains an Unity Executable before adding it to the list of possible Editors which could be patched.

Do you have any Feedback on this?

maximilianmaihoefner avatar May 29 '20 16:05 maximilianmaihoefner

I'd assume it's installed to the UnityHub directories on other OSes as well, though that's something we'd definitely have to verify. One thing to also verify would be what the hub's behaviour is when you have multiple installs in different locations, perhaps the contents of the file would turn into a JSON array?

You could probably just read the contents of the file and add them to the Unity paths, and let the patcher do its thing from there. Sounds like a good change though! 👍

aevitas avatar Jun 01 '20 15:06 aevitas