Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(mcp): normalize native paths on Windows

t8y2fd846d940af2
diff --git a/src-tauri/src/commands/mcp_native_installation.rs b/src-tauri/src/commands/mcp_native_installation.rs
index c341ecac38..ff2f674854 100644
--- a/src-tauri/src/commands/mcp_native_installation.rs
+++ b/src-tauri/src/commands/mcp_native_installation.rs
@@ -45,8 +45,12 @@ fn home_directory() -> Option<PathBuf> {
std::env::var_os(if cfg!(windows) { "USERPROFILE" } else { "HOME" }).map(PathBuf::from)
}
+fn standalone_bin_directory(home: &Path) -> PathBuf {
+ home.join(".dbx").join("bin")
+}
+
fn discover_standalone() -> Option<NativeInstallation> {
- discover(&home_directory()?.join(".dbx/bin"))
+ discover(&standalone_bin_directory(&home_directory()?))
}
fn parse_version(value: &str) -> Option<String> {
@@ -191,7 +195,7 @@ impl NativeInstallation {
fn uninstall_standalone(&self) -> Result<String, String> {
let expected = home_directory()
- .map(|home| home.join(".dbx/bin").join(if cfg!(windows) { "dbx-mcp.exe" } else { "dbx-mcp" }))
+ .map(|home| standalone_bin_directory(&home).join(if cfg!(windows) { "dbx-mcp.exe" } else { "dbx-mcp" }))
.ok_or_else(|| "Unable to resolve the user home directory.".to_string())?;
if self.binary != expected {
return Err(format!("Refusing to remove unexpected native MCP path: {}", self.binary.display()));
@@ -310,6 +314,21 @@ fn require_success(output: Output, action: &str) -> Result<(), String> {
mod tests {
use super::*;
+ #[test]
+ fn standalone_bin_directory_uses_separate_path_components() {
+ let home = Path::new("/home/example");
+ assert_eq!(standalone_bin_directory(home), home.join(".dbx").join("bin"));
+ }
+
+ #[cfg(windows)]
+ #[test]
+ fn standalone_bin_directory_uses_windows_separators() {
+ assert_eq!(
+ standalone_bin_directory(Path::new(r"C:\Users\86139")).to_string_lossy(),
+ r"C:\Users\86139\.dbx\bin"
+ );
+ }
+
#[test]
fn parses_version_output_and_rejects_marker_commands() {
assert_eq!(parse_version("dbx-mcp 0.4.96\n").as_deref(), Some("0.4.96"));