From 56ffd29bc85430fe93c0119bd6f5c28cfcdb58ca Mon Sep 17 00:00:00 2001 From: Fabian-Lars Date: Mon, 15 Jul 2024 19:00:43 +0200 Subject: [PATCH] fix(core/windows): Remove UNC prefix from tempdir fn (#10288) fixes #10285 --- .changes/fix-remove-tempdir-unc-prefix.md | 5 +++++ core/tauri/src/endpoints/operating_system.rs | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .changes/fix-remove-tempdir-unc-prefix.md diff --git a/.changes/fix-remove-tempdir-unc-prefix.md b/.changes/fix-remove-tempdir-unc-prefix.md new file mode 100644 index 000000000000..a709c171c129 --- /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 365cb4059e76..5511a68efba6 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> {