diff --git a/src/backend/src/lib.rs b/src/backend/src/lib.rs index b304b53..d981911 100644 --- a/src/backend/src/lib.rs +++ b/src/backend/src/lib.rs @@ -185,8 +185,14 @@ // Note: Tauri's sidecar() handles the library path (DLLs) if they are in the same folder // as the sidecar binary in the App bundle. + // However, on Windows, adding the resource dir to PATH is safer for DLL discovery. + let res_dir = app_handle.path().resource_dir().unwrap_or_default(); + let old_path = std::env::var("PATH").unwrap_or_default(); + let new_path = format!("{};{}", res_dir.display(), old_path); - let (mut rx, child) = match sidecar.args(args).spawn() { + let sidecar = sidecar.args(args).env("PATH", new_path); + + let (mut rx, _child) = match sidecar.spawn() { Ok(res) => res, Err(e) => { eprintln!("CRITICAL: Failed to spawn sidecar: {}", e);