From ca52e74441dee7be05b6d8a959ad5b24562c0519 Mon Sep 17 00:00:00 2001 From: Aalivexy Date: Fri, 26 Jun 2026 15:39:43 +0800 Subject: [PATCH] fix: normalize backslashes in env.fish fallback path for Windows/msys --- crates/vite_global_cli/src/commands/env/setup.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/vite_global_cli/src/commands/env/setup.rs b/crates/vite_global_cli/src/commands/env/setup.rs index 17f7963e94..fe0081c380 100644 --- a/crates/vite_global_cli/src/commands/env/setup.rs +++ b/crates/vite_global_cli/src/commands/env/setup.rs @@ -758,7 +758,7 @@ fn render_env_content(shell: EnvShell, vite_plus_home: &vite_path::AbsolutePath) // Normalize to forward slashes for $HOME/... paths (POSIX-style) format!("$HOME/{}", s.display().to_string().replace('\\', "/")) }) - .unwrap_or_else(|| bin_path.as_path().display().to_string()); + .unwrap_or_else(|| bin_path.as_path().display().to_string().replace('\\', "/")); match shell { EnvShell::Posix => ENV_TEMPLATE_POSIX.replace("__VP_BIN__", &bin_path_ref), @@ -976,7 +976,7 @@ mod tests { // Should use absolute path since install dir is not under HOME let expected_bin = home.join("bin"); - let expected_str = expected_bin.as_path().display().to_string(); + let expected_str = expected_bin.as_path().display().to_string().replace('\\', "/"); assert!( env_content.contains(&expected_str), "env file should use absolute path {expected_str}, got: {env_content}"