from __future__ import annotations import os from pathlib import Path from .constants import MODEL_REVISION def data_home() -> Path: value = os.environ.get("XDG_DATA_HOME") return Path(value).expanduser() if value else Path.home() / ".local" / "share" def cache_home() -> Path: value = os.environ.get("XDG_CACHE_HOME") return Path(value).expanduser() if value else Path.home() / ".cache" def default_model_dir() -> Path: override = os.environ.get("UNLIMITED_OCR_MODEL_DIR") if override: return Path(override).expanduser() return data_home() / "unlimited-ocr-rdna4" / "models" / MODEL_REVISION def default_cache_dir() -> Path: return cache_home() / "unlimited-ocr-rdna4"