Files
StarPilot/openpilot/starpilot/maps/storage.py
T
firestar5683 1ce9f73ae2 Navigation and maps
Add navigation and map matching providers with the vendored map service sources.
2026-10-03 22:34:37 +00:00

15 lines
417 B
Python

import os
from pathlib import Path
import re
STORAGE_ANCHOR = Path('/data/media/0')
def offline_root(anchor: Path = STORAGE_ANCHOR) -> Path:
prefix = os.environ.get('OPENPILOT_PREFIX', '')
if prefix and re.fullmatch(r'[A-Za-z0-9_-]{1,64}', prefix) is None:
raise ValueError('Invalid map storage namespace')
name = f'starpilot-{prefix}' if prefix else 'starpilot'
return anchor / name / 'maps/offline'