Skip to content

dialog.SaveDialogOption's defaultPath fails if the file already exists #3091

@OJFord

Description

@OJFord

Describe the bug

The defaultPath given to dialog.save, if it's a filename, only works if it doesn't already exist.

Otherwise, the default filename is blank, and the directory open for selection is the parent of tauri.conf.json, as if it wasn't provided.

To Reproduce

$ touch /tmp/test.txt
dialog.save({
  defaultPath: "/tmp/test.txt",
})

Expected behavior

  • filename is defaulted to test.txt
  • directory is defaulted to /tmp

Screenshots

N/A

Platform and Versions (required):

$ cargo tauri dev
Operating System - Arch Linux, version Unknown X64

Node.js environment
  Node.js - 17.3.0

  @tauri-apps/cli - 1.0.0-beta.10


  @tauri-apps/api - 1.0.0-beta.8

Global packages
  npm - 8.3.0
  pnpm - Not installed
  yarn - 1.22.17

Rust environment
  rustc - 1.56.0
  cargo - 1.56.0

App directory structure
/components
/dist
/src-tauri
/node_modules

App
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("unexpected character '^' while parsing major version number")', src/info.rs:637:45
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Additional context

N/A

Stack Trace

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions