21 lines
654 B
Python
21 lines
654 B
Python
from __future__ import annotations
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
ROOT_DIR = Path(__file__).resolve().parent.parent
|
|
_PTS_DATA_DIR = os.environ.get("PTS_DATA_DIR", "").strip()
|
|
DATA_DIR = Path(_PTS_DATA_DIR) if _PTS_DATA_DIR else Path(__file__).resolve().parent / "data"
|
|
DATA_DIR.mkdir(parents=True, exist_ok=True)
|
|
EXTENSION_DIR = ROOT_DIR / "extension"
|
|
|
|
|
|
def get_env_files() -> tuple[str, ...]:
|
|
candidates = [DATA_DIR / ".env", ROOT_DIR / ".env"]
|
|
return tuple(str(path) for path in candidates if path.exists())
|
|
|
|
|
|
def get_dates_file_path() -> Path:
|
|
if _PTS_DATA_DIR:
|
|
return DATA_DIR / "dates.txt"
|
|
return ROOT_DIR / "dates.txt" |