From fe43d824c5c0908130e57308ae22c124c4843ee2 Mon Sep 17 00:00:00 2001 From: lizhongxiang Date: Wed, 26 Feb 2025 18:03:40 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E9=83=A8=E7=BD=B2=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 4 ++++ core/utils/util.py | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 70499281e..1ca41fd49 100644 --- a/app.py +++ b/app.py @@ -1,8 +1,12 @@ import asyncio +import os +from pathlib import Path + from config.logger import setup_logging from config.settings import load_config from core.server import WebSocketServer +os.environ["PROJECT_ROOT_PATH"] = str(Path(__file__).resolve().parent) async def main(): setup_logging() # 最先初始化日志 diff --git a/core/utils/util.py b/core/utils/util.py index bc5a1c389..01e26375e 100644 --- a/core/utils/util.py +++ b/core/utils/util.py @@ -6,9 +6,7 @@ import json def get_project_dir(): - projectName = 'xiaozhi-esp32-server' - filePath = os.path.abspath(__file__) - return filePath[:filePath.rfind('/' + projectName + '/') + len(projectName) + 2] + return os.environ["PROJECT_ROOT_PATH"] def get_local_ip():