Spaces:
Sleeping
Sleeping
| from __future__ import annotations | |
| import sys | |
| from pathlib import Path | |
| def resolve_app_root() -> Path: | |
| if getattr(sys, "frozen", False): | |
| return Path(sys.executable).resolve().parent | |
| return Path(__file__).resolve().parents[2] | |
| def resolve_bundle_root() -> Path: | |
| meipass = getattr(sys, "_MEIPASS", None) | |
| if meipass: | |
| return Path(str(meipass)).resolve() | |
| if getattr(sys, "frozen", False): | |
| return Path(sys.executable).resolve().parent | |
| return resolve_app_root() | |
| def resolve_frontend_dist_dir() -> Path: | |
| base = resolve_bundle_root() if getattr(sys, "frozen", False) else resolve_app_root() | |
| return base / "frontend" / "dist" | |
| def resolve_core_path(*parts: str) -> Path: | |
| if getattr(sys, "frozen", False): | |
| return resolve_bundle_root().joinpath("app", "core", *parts) | |
| return resolve_app_root().joinpath("backend", "app", "core", *parts) | |
| def resolve_local_data_path(*parts: str) -> Path: | |
| if getattr(sys, "frozen", False): | |
| return resolve_bundle_root().joinpath("local_data", *parts) | |
| return resolve_app_root().joinpath("backend", "local_data", *parts) | |