Check if path is a valid Unity project. A valid Unity project contains: - Assets/ directory - ProjectSettings/ directory - ProjectSettings/ProjectVersion.txt file
(path: Path)
| 69 | |
| 70 | |
| 71 | def is_unity_project(path: Path) -> bool: |
| 72 | """Check if path is a valid Unity project. |
| 73 | |
| 74 | A valid Unity project contains: |
| 75 | - Assets/ directory |
| 76 | - ProjectSettings/ directory |
| 77 | - ProjectSettings/ProjectVersion.txt file |
| 78 | """ |
| 79 | if not path.is_dir(): |
| 80 | return False |
| 81 | |
| 82 | assets_dir = path / "Assets" |
| 83 | project_settings_dir = path / "ProjectSettings" |
| 84 | version_file = project_settings_dir / "ProjectVersion.txt" |
| 85 | |
| 86 | return ( |
| 87 | assets_dir.exists() |
| 88 | and assets_dir.is_dir() |
| 89 | and project_settings_dir.exists() |
| 90 | and project_settings_dir.is_dir() |
| 91 | and version_file.exists() |
| 92 | ) |
| 93 | |
| 94 | |
| 95 | # ============================================================================= |
no outgoing calls
no test coverage detected