From 97efa3ab38f81ef534096e23c5f925bf61c05852 Mon Sep 17 00:00:00 2001 From: LIghtJUNction Date: Sat, 21 Mar 2026 13:54:39 +0800 Subject: [PATCH] Fix: _BUNDLED_DIST undefined, use self.bundled_dist instead --- astrbot/core/utils/astrbot_path.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/astrbot/core/utils/astrbot_path.py b/astrbot/core/utils/astrbot_path.py index 5f1f35cb0..a0931191e 100644 --- a/astrbot/core/utils/astrbot_path.py +++ b/astrbot/core/utils/astrbot_path.py @@ -21,6 +21,7 @@ import anyio from astrbot.core.utils.runtime_env import is_packaged_desktop_runtime + class AstrbotPaths: """Astrbot 项目路径管理类""" @@ -30,7 +31,6 @@ class AstrbotPaths: env_candidates = [] - # 1) current working directory .env env_candidates.append(Path.cwd() / ".env") @@ -73,7 +73,7 @@ class AstrbotPaths: @property def has_dashboard(self) -> bool: """Check if the dashboard is installed""" - if _BUNDLED_DIST.is_dir(): + if self.bundled_dist.is_dir(): return True dashboard_version = self.dashboard_version match dashboard_version: @@ -86,7 +86,7 @@ class AstrbotPaths: async def async_has_dashboard(self) -> bool: """Check if the dashboard is installed (async)""" - if _BUNDLED_DIST.is_dir(): + if self.bundled_dist.is_dir(): return True dashboard_version = await self.async_dashboard_version() match dashboard_version: @@ -106,9 +106,9 @@ class AstrbotPaths: return None @property - def bundled_dist(self) -> Path : + def bundled_dist(self) -> Path: return self.project_root / "dashboard" / "dist" - + async def async_dashboard_version(self) -> str | None: try: # anyio.open_file returns a coroutine that yields an async file object.