Describe the bug
On Windows under msys2, the generated env.fish file contains backslash-separated paths (e.g., C:\Users\[username]\.vite-plus\bin) instead of forward-slash paths. Fish interprets backslashes as escape characters, causing a syntax error when sourcing the file.
The root cause lies in the crates/vite_global_cli/src/commands/env/setup.rs file. When the installation directory is under $HOME, the code normalizes the backslashes using .replace('\\', "/"). However, the alternative path (unwrap_or_else) outputs the unnormalized raw std::path::Display result, producing a path like C:\Users\[username]\.vite-plus\bin.
I can open PR if needed.
diff --git a/crates/vite_global_cli/src/commands/env/setup.rs b/crates/vite_global_cli/src/commands/env/setup.rs
index 17f7963e..ca84a313 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),
Reproduction
N/A
Steps to reproduce
- Install Vite+ on Windows
- Run source "/c/Users/[username]/.vite-plus/env.fish" in MSYS2 fish shell
System Info
VITE+ - The Unified Toolchain for the Web
Environment:
Version 24.18.0
Source lts
Tool Paths:
node C:\Users\aalivexy\.vite-plus\js_runtime\node\24.18.0\node.exe
npm C:\Users\aalivexy\.vite-plus\js_runtime\node\24.18.0\npm.cmd
npx C:\Users\aalivexy\.vite-plus\js_runtime\node\24.18.0\npx.cmd
VITE+ - The Unified Toolchain for the Web
vp v0.2.1
Local vite-plus:
vite-plus Not found
Tools:
vite Not found
rolldown Not found
vitest Not found
oxfmt Not found
oxlint Not found
oxlint-tsgolint Not found
tsdown Not found
Environment:
Package manager Not found
Node.js v24.18.0
Used Package Manager
pnpm
Logs
Validations
Describe the bug
On Windows under msys2, the generated
env.fishfile contains backslash-separated paths (e.g.,C:\Users\[username]\.vite-plus\bin) instead of forward-slash paths. Fish interprets backslashes as escape characters, causing a syntax error when sourcing the file.The root cause lies in the
crates/vite_global_cli/src/commands/env/setup.rsfile. When the installation directory is under$HOME, the code normalizes the backslashes using.replace('\\', "/"). However, the alternative path (unwrap_or_else) outputs the unnormalized rawstd::path::Displayresult, producing a path likeC:\Users\[username]\.vite-plus\bin.I can open PR if needed.
Reproduction
N/A
Steps to reproduce
System Info
Used Package Manager
pnpm
Logs
Validations