From 3f58526df8bf9787227a51380c7ab06a9968cfef Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Wed, 10 Jun 2026 21:31:52 +0800 Subject: [PATCH] fix(mcp): add back use std::env, use compile-time #[cfg] for locate_mcp_bin --- src-tauri/src/commands/mcp.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/commands/mcp.rs b/src-tauri/src/commands/mcp.rs index 6cc8f7b67d..5a86401385 100644 --- a/src-tauri/src/commands/mcp.rs +++ b/src-tauri/src/commands/mcp.rs @@ -1,3 +1,4 @@ +use std::env; use std::path::Path; use std::process::Command; use std::time::Duration; @@ -91,10 +92,14 @@ fn installed_mcp_version() -> Option { } fn locate_mcp_bin() -> Option { - if cfg!(windows) { + #[cfg(windows)] + { return locate_windows_command("dbx-mcp-server"); } - command_stdout("which", &["dbx-mcp-server"]).ok().and_then(first_non_empty_line) + #[cfg(not(windows))] + { + command_stdout("which", &["dbx-mcp-server"]).ok().and_then(first_non_empty_line) + } } #[cfg(windows)]