Summary
CodeRabbit identified a Windows-specific issue in PR #16: std::fs::canonicalize on Windows produces extended-length UNC paths with \\?\ prefix, which are incompatible with many applications including Node.js.
Problem
In ipc_common.rs:25-27, the code uses:
Ok(abs_path) => {
let path_str = abs_path.to_string_lossy().to_string();
On Windows, canonicalize converts paths like C:\Users\... to \\?\C:\Users\.... The frontend "open-file" event handler (which uses Node.js/JavaScript) will receive this broken path string, causing failures on Windows - the primary platform this fix was meant to support.
Solution Options
Option 1: Manual prefix strip (no dependencies)
Ok(abs_path) => {
// Strip Windows extended-length prefix so the frontend
// receives a plain path like C:\... instead of \\?\C:\...
let path_str = abs_path.to_string_lossy()
.strip_prefix(r"\\?\")
.map(str::to_string)
.unwrap_or_else(|| abs_path.to_string_lossy().to_string());
Option 2: Use dunce crate (recommended)
Add to Cargo.toml:
Replace std::fs::canonicalize with dunce::canonicalize:
match dunce::canonicalize(&path) {
Ok(abs_path) => {
let path_str = abs_path.to_string_lossy().to_string();
The dunce crate is widely used as a wrapper over std::fs::canonicalize that automatically strips the \\?\ prefix on Windows.
References
Files Affected
apps/tauri/src-tauri/src/ipc_common.rs
Summary
CodeRabbit identified a Windows-specific issue in PR #16:
std::fs::canonicalizeon Windows produces extended-length UNC paths with\\?\prefix, which are incompatible with many applications including Node.js.Problem
In
ipc_common.rs:25-27, the code uses:On Windows,
canonicalizeconverts paths likeC:\Users\...to\\?\C:\Users\.... The frontend "open-file" event handler (which uses Node.js/JavaScript) will receive this broken path string, causing failures on Windows - the primary platform this fix was meant to support.Solution Options
Option 1: Manual prefix strip (no dependencies)
Option 2: Use
duncecrate (recommended)Add to
Cargo.toml:Replace
std::fs::canonicalizewithdunce::canonicalize:The
duncecrate is widely used as a wrapper overstd::fs::canonicalizethat automatically strips the\\?\prefix on Windows.References
Files Affected
apps/tauri/src-tauri/src/ipc_common.rs