From d165579cab29c6224713ecf4bb4f70688118a0db Mon Sep 17 00:00:00 2001 From: Minidoracat Date: Sun, 15 Jun 2025 19:58:10 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E6=AD=A3=E6=89=93?= =?UTF-8?q?=E5=8C=85=E5=BE=8C=E6=9F=A5=E8=A9=A2=E5=9F=B7=E8=A1=8C=E6=AA=94?= =?UTF-8?q?=E9=82=8F=E8=BC=AF=E5=92=8C=E5=A2=9E=E5=8A=A0=E8=AA=BF=E8=A9=A6?= =?UTF-8?q?=E8=A8=8A=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../desktop_app/desktop_app.py | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/mcp_feedback_enhanced/desktop_app/desktop_app.py b/src/mcp_feedback_enhanced/desktop_app/desktop_app.py index f48d807..ec9d452 100644 --- a/src/mcp_feedback_enhanced/desktop_app/desktop_app.py +++ b/src/mcp_feedback_enhanced/desktop_app/desktop_app.py @@ -115,15 +115,24 @@ class DesktopApp: # 找到 Tauri 可執行檔案 # 首先嘗試從打包後的位置找(PyPI 安裝後的位置) try: + debug_log("嘗試從發布包位置導入桌面模組...") from mcp_feedback_enhanced.desktop_release import __file__ as desktop_init desktop_dir = Path(desktop_init).parent + debug_log(f"桌面應用目錄: {desktop_dir}") + + # 列出目錄內容以便調試 + if desktop_dir.exists(): + debug_log(f"桌面目錄內容: {list(desktop_dir.iterdir())}") + else: + debug_log(f"桌面目錄不存在: {desktop_dir}") # 根據平台選擇對應的二進制文件 import platform system = platform.system().lower() machine = platform.machine().lower() + debug_log(f"檢測到平台: {system}, 架構: {machine}") # 定義平台到二進制文件的映射 if system == "windows": @@ -144,9 +153,17 @@ class DesktopApp: # 回退到通用名稱 tauri_exe = desktop_dir / "mcp-feedback-enhanced-desktop" + debug_log(f"預期的可執行檔案路徑: {tauri_exe}") + if tauri_exe.exists(): debug_log(f"找到打包後的 Tauri 可執行檔案: {tauri_exe}") + # 檢查文件權限 + file_stat = tauri_exe.stat() + debug_log( + f"文件權限: {oct(file_stat.st_mode)}, 大小: {file_stat.st_size} bytes" + ) else: + debug_log(f"主要可執行檔案不存在: {tauri_exe}") # 嘗試回退選項 fallback_files = [ desktop_dir / "mcp-feedback-enhanced-desktop.exe", @@ -156,7 +173,9 @@ class DesktopApp: desktop_dir / "mcp-feedback-enhanced-desktop", ] + debug_log("嘗試回退選項...") for fallback in fallback_files: + debug_log(f"檢查回退文件: {fallback} - 存在: {fallback.exists()}") if fallback.exists(): tauri_exe = fallback debug_log(f"使用回退的可執行檔案: {tauri_exe}") @@ -166,7 +185,8 @@ class DesktopApp: f"找不到任何可執行檔案,檢查的路徑: {tauri_exe}" ) - except (ImportError, FileNotFoundError): + except (ImportError, FileNotFoundError) as e: + debug_log(f"從發布包位置導入失敗: {e}") # 回退到開發環境路徑 debug_log("未找到打包後的可執行檔案,嘗試開發環境路徑...") project_root = Path(__file__).parent.parent.parent.parent