Walk up from *start* looking for ``.cocoindex_code/settings.yml``. Returns the directory containing it, or ``None``.
(start: Path)
| 322 | |
| 323 | |
| 324 | def find_project_root(start: Path) -> Path | None: |
| 325 | """Walk up from *start* looking for ``.cocoindex_code/settings.yml``. |
| 326 | |
| 327 | Returns the directory containing it, or ``None``. |
| 328 | """ |
| 329 | current = start.resolve() |
| 330 | while True: |
| 331 | if (current / _SETTINGS_DIR_NAME / _SETTINGS_FILE_NAME).is_file(): |
| 332 | return current |
| 333 | parent = current.parent |
| 334 | if parent == current: |
| 335 | return None |
| 336 | current = parent |
| 337 | |
| 338 | |
| 339 | def find_legacy_project_root(start: Path) -> Path | None: |
no outgoing calls