refactor(paths): remove cwd-based mapping path fallbacks

This commit is contained in:
Your Name committed 2026-06-01 09:15:41 +08:00
1 parent 37f736c158
commit de21921d03
5 files changed
+57 -9

No files matched your search

+5 -5
View File
@@ -3,21 +3,21 @@ import os
from datetime import datetime
from typing import Any, Dict, List, Tuple
from douyin.core import path_config
def load_reservations(base_dir: str | None = None) -> Dict[int, Any]:
"""加载 reservations.json 并返回以 pos_seen 为键的映射字典。"""
if not base_dir:
try:
base_dir = os.path.abspath(
os.path.join(os.path.dirname(__file__), "..", "..")
)
base_dir = path_config.get_project_root()
except Exception:
base_dir = os.getcwd()
base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
reservations_data: Dict[int, Any] = {}
reservations_paths = [
path_config.get_reservations_path(),
os.path.join(base_dir, "douyin", "core", "state", "reservations.json"),
os.path.join(os.getcwd(), "douyin", "core", "state", "reservations.json"),
]
for res_path in reservations_paths:
try: