Skip to content

Commit 50a3d17

Browse files
fix(core/dialog): reconstruct path using appropriate separator, closes #8074 (#8408)
* fix(core/dialog): reconstruct path using appropraite separator, closes #8074 * Update dialog-window-forward-slash.md * Update dialog.rs * Update core/tauri/src/endpoints/dialog.rs --------- Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
1 parent 9b230de commit 50a3d17

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'tauri': 'patch:bug'
3+
---
4+
5+
On Windows, fix `open` dialog `defaultPath`, when invoked from JS, not working if the path uses forward slash (`/`)

core/tauri/src/endpoints/dialog.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ fn set_default_path(
301301
mut dialog_builder: FileDialogBuilder,
302302
default_path: PathBuf,
303303
) -> FileDialogBuilder {
304+
// we need to adjust the separator on Windows: https://github.com/tauri-apps/tauri/issues/8074
305+
let default_path: PathBuf = default_path.components().collect();
304306
if default_path.is_file() || !default_path.exists() {
305307
if let (Some(parent), Some(file_name)) = (default_path.parent(), default_path.file_name()) {
306308
if parent.components().count() > 0 {

0 commit comments

Comments
 (0)