liumaolin
commited on
Commit
·
664d767
1
Parent(s):
511ff0c
Update `paths.py`: improve PROJECT_ROOT resolution with `_MEIPASS` support and enhance third-party path handling.
Browse files
src/voice_dialogue/config/paths.py
CHANGED
@@ -3,7 +3,8 @@ from pathlib import Path
|
|
3 |
|
4 |
# 项目根目录
|
5 |
HERE = Path(__file__).parent
|
6 |
-
|
|
|
7 |
|
8 |
# 资源路径 - 统一到assets目录
|
9 |
ASSETS_PATH = PROJECT_ROOT / "assets"
|
@@ -27,5 +28,5 @@ FRONTEND_ASSETS_PATH = ASSETS_PATH / "www"
|
|
27 |
|
28 |
def load_third_party():
|
29 |
# 添加第三方库到 Python 路径
|
30 |
-
if str(THIRD_PARTY_PATH) not in sys.path:
|
31 |
sys.path.insert(0, str(THIRD_PARTY_PATH))
|
|
|
3 |
|
4 |
# 项目根目录
|
5 |
HERE = Path(__file__).parent
|
6 |
+
_project_root = getattr(sys, '_MEIPASS', HERE.parent.parent.parent.as_posix())
|
7 |
+
PROJECT_ROOT = Path(_project_root)
|
8 |
|
9 |
# 资源路径 - 统一到assets目录
|
10 |
ASSETS_PATH = PROJECT_ROOT / "assets"
|
|
|
28 |
|
29 |
def load_third_party():
|
30 |
# 添加第三方库到 Python 路径
|
31 |
+
if THIRD_PARTY_PATH.exists() and str(THIRD_PARTY_PATH) not in sys.path:
|
32 |
sys.path.insert(0, str(THIRD_PARTY_PATH))
|