List installed Unity editors from filesystem. Scans the editor installation directory for valid Unity installations.
()
| 111 | |
| 112 | |
| 113 | def get_installed_editors() -> list[InstalledEditor]: |
| 114 | """List installed Unity editors from filesystem. |
| 115 | |
| 116 | Scans the editor installation directory for valid Unity installations. |
| 117 | """ |
| 118 | paths = get_platform_paths() |
| 119 | editors: list[InstalledEditor] = [] |
| 120 | |
| 121 | if not paths.editor_base.exists(): |
| 122 | return editors |
| 123 | |
| 124 | for version_dir in paths.editor_base.iterdir(): |
| 125 | if not version_dir.is_dir(): |
| 126 | continue |
| 127 | |
| 128 | binary_path = _get_editor_binary_path(paths.editor_base, version_dir.name) |
| 129 | if binary_path.exists(): |
| 130 | editors.append( |
| 131 | InstalledEditor( |
| 132 | version=version_dir.name, |
| 133 | path=binary_path, |
| 134 | ) |
| 135 | ) |
| 136 | |
| 137 | # Sort by version (newest first, simple string sort) |
| 138 | editors.sort(key=lambda e: e.version, reverse=True) |
| 139 | return editors |
| 140 | |
| 141 | |
| 142 | def find_editor_by_version(version: str) -> InstalledEditor | None: |
no test coverage detected