File size: 767 Bytes
d2e6f94 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | from __future__ import annotations
from pathlib import Path
from config import load_settings
from .storage import read_json
def load_map_metadata() -> dict:
settings = load_settings()
return read_json(settings.map_metadata_path)
def image_for_layer(layer: str) -> str:
settings = load_settings()
metadata = load_map_metadata()
images = metadata.get("images", {})
if layer not in images:
raise KeyError(f"Unknown map layer: {layer}")
# Processed metadata may store Windows-style separators; normalize so the
# paths resolve on Linux (e.g. inside a Docker Space) as well.
path = Path(str(images[layer]).replace("\\", "/"))
if not path.is_absolute():
path = settings.project_root / path
return str(path)
|