(env_name: str, default_relative: str)
| 372 | |
| 373 | |
| 374 | def _configured_path(env_name: str, default_relative: str) -> str: |
| 375 | notes_root = _configured_notes_root_dir() |
| 376 | if notes_root is not None: |
| 377 | if env_name in {"PAPERFLOW_PDF_DIR", "PAPERFLOW_READING_REPORTS_DIR"}: |
| 378 | return str(notes_root) |
| 379 | if env_name == "PAPERFLOW_WIKI_DIR": |
| 380 | return str(notes_root / "wiki") |
| 381 | raw = os.environ.get(env_name, "").strip() |
| 382 | if raw: |
| 383 | path = Path(raw).expanduser() |
| 384 | if not path.is_absolute(): |
| 385 | path = PROJECT_ROOT / path |
| 386 | return str(path) |
| 387 | return str(PROJECT_ROOT / default_relative) |
| 388 | |
| 389 | |
| 390 | def _configured_notes_root_dir() -> Optional[Path]: |
no test coverage detected