mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-12 07:44:18 +00:00
12 lines
No EOL
384 B
Python
12 lines
No EOL
384 B
Python
from pathlib import Path
|
|
|
|
_ROOT_MARKERS = ("Cargo.toml", ".git")
|
|
|
|
def project_root() -> Path:
|
|
p = Path(__file__).resolve()
|
|
for candidate in [p] + list(p.parents):
|
|
for marker in _ROOT_MARKERS:
|
|
if (candidate / marker).exists():
|
|
return candidate
|
|
# Fallback: original behavior (two parents up)
|
|
return Path(__file__).resolve().parents[2] |