diff --git a/.changes/fix-remove-tempdir-unc-prefix.md b/.changes/fix-remove-tempdir-unc-prefix.md new file mode 100644 index 00000000000..a709c171c12 --- /dev/null +++ b/.changes/fix-remove-tempdir-unc-prefix.md @@ -0,0 +1,5 @@ +--- +tauri: "patch:bug" +--- + +Fixed a regression that added the `\\?\` UNC prefix to the path returned from the `tempdir()` command. diff --git a/core/tauri/src/endpoints/operating_system.rs b/core/tauri/src/endpoints/operating_system.rs index 365cb4059e7..5511a68efba 100644 --- a/core/tauri/src/endpoints/operating_system.rs +++ b/core/tauri/src/endpoints/operating_system.rs @@ -42,7 +42,12 @@ impl Cmd { } fn tempdir(_context: InvokeContext) -> super::Result { - Ok(std::env::temp_dir().canonicalize()?) + #[cfg(windows)] + use dunce::canonicalize; + #[cfg(not(windows))] + use std::fs::canonicalize; + + Ok(canonicalize(std::env::temp_dir())?) } fn locale(_context: InvokeContext) -> super::Result> {