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 -4
View File
@@ -6,6 +6,8 @@ from tkinter import ttk
from typing import Any, List
from datetime import datetime
from douyin.core import path_config
try:
from . import mapping_utils
except Exception:
@@ -174,11 +176,11 @@ def create_mapping_tab(root: tk.Tk, notebook: ttk.Notebook, cfg: dict) -> ttk.Fr
# 读取预约队列与映射表(使用 mapping_utils 模块以实现模块化)
try:
base_dir = path_config.get_project_root()
except Exception:
base_dir = os.path.abspath(
os.path.join(os.path.dirname(__file__), "..", "..")
)
except Exception:
base_dir = os.getcwd()
# 尝试通过工具模块加载 reservations 信息
reservations_data = {}
@@ -190,8 +192,7 @@ def create_mapping_tab(root: tk.Tk, notebook: ttk.Notebook, cfg: dict) -> ttk.Fr
possible_paths = [
os.path.join(base_dir, "douyin", "core", "state", "room_pos_map.json"),
os.path.join(base_dir, "douyin", "core", "state", "reservations.json"),
os.path.join(os.getcwd(), "douyin", "core", "state", "room_pos_map.json"),
path_config.get_reservations_path(),
]
found = False