24 lines
592 B
Python
24 lines
592 B
Python
from __future__ import annotations
|
||
|
||
from functools import lru_cache
|
||
from pathlib import Path
|
||
|
||
|
||
@lru_cache(maxsize=1)
|
||
def get_root_path() -> Path:
|
||
"""返回项目根目录:从 utils/path.py 回退到仓库根 (../../..)。"""
|
||
return Path(__file__).resolve().parents[4]
|
||
|
||
|
||
@lru_cache(maxsize=1)
|
||
def get_apps_path() -> Path:
|
||
"""返回 apps 目录路径。"""
|
||
return get_root_path() / "apps"
|
||
|
||
|
||
@lru_cache(maxsize=1)
|
||
def get_jingrow_root() -> Path:
|
||
"""返回 jingrow 模块根目录路径:apps/jingrow/jingrow"""
|
||
return get_root_path() / "apps" / "jingrow" / "jingrow"
|
||
|