Platform-specific Hub CLI locations (ordered by priority).
()
| 27 | |
| 28 | |
| 29 | def _get_platform_hub_candidates() -> list[Path]: |
| 30 | """Platform-specific Hub CLI locations (ordered by priority).""" |
| 31 | if sys.platform == "darwin": |
| 32 | return [ |
| 33 | Path("/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"), |
| 34 | Path.home() / "Applications/Unity Hub.app/Contents/MacOS/Unity Hub", |
| 35 | ] |
| 36 | elif sys.platform == "win32": |
| 37 | localappdata = os.environ.get("LOCALAPPDATA", "") |
| 38 | programfiles_x86 = os.environ.get("ProgramFiles(x86)", "") # noqa: SIM112 |
| 39 | candidates = [ |
| 40 | Path(r"C:\Program Files\Unity Hub\Unity Hub.exe"), |
| 41 | ] |
| 42 | if programfiles_x86: |
| 43 | candidates.append(Path(programfiles_x86) / "Unity Hub" / "Unity Hub.exe") |
| 44 | if localappdata: |
| 45 | candidates.append(Path(localappdata) / "Programs" / "Unity Hub" / "Unity Hub.exe") |
| 46 | return candidates |
| 47 | else: # Linux |
| 48 | return [ |
| 49 | Path("/opt/unityhub/unityhub"), |
| 50 | Path.home() / "Unity/Hub/UnityHub.AppImage", |
| 51 | Path.home() / ".local/share/applications/unityhub.AppImage", |
| 52 | ] |
| 53 | |
| 54 | |
| 55 | def _get_platform_editor_base() -> Path: |