pub struct FileDialogBuilder(_);
Available on desktop and crate feature dialog only.
Expand description

The file dialog builder.

Constructs file picker dialogs that can select single/multiple files or directories.

Implementations§

Gets the default file dialog builder.

Add file extension filter. Takes in the name of the filter, and list of extensions

Set starting directory of the dialog.

Set starting file name of the dialog.

Sets the parent window of the dialog.

Set the title of the dialog.

Shows the dialog to select a single file. This is a blocking operation, and should NOT be used when running on the main thread context.

Examples
use tauri::api::dialog::blocking::FileDialogBuilder;
#[tauri::command]
async fn my_command() {
  let file_path = FileDialogBuilder::new().pick_file();
  // do something with the optional file path here
  // the file path is `None` if the user closed the dialog
}

Shows the dialog to select multiple files. This is a blocking operation, and should NOT be used when running on the main thread context.

Examples
use tauri::api::dialog::blocking::FileDialogBuilder;
#[tauri::command]
async fn my_command() {
  let file_path = FileDialogBuilder::new().pick_files();
  // do something with the optional file paths here
  // the file paths value is `None` if the user closed the dialog
}

Shows the dialog to select a single folder. This is a blocking operation, and should NOT be used when running on the main thread context.

Examples
use tauri::api::dialog::blocking::FileDialogBuilder;
#[tauri::command]
async fn my_command() {
  let folder_path = FileDialogBuilder::new().pick_folder();
  // do something with the optional folder path here
  // the folder path is `None` if the user closed the dialog
}

Shows the dialog to select multiple folders. This is a blocking operation, and should NOT be used when running on the main thread context.

Examples
use tauri::api::dialog::blocking::FileDialogBuilder;
#[tauri::command]
async fn my_command() {
  let folder_paths = FileDialogBuilder::new().pick_folders();
  // do something with the optional folder paths here
  // the folder paths value is `None` if the user closed the dialog
}

Shows the dialog to save a file. This is a blocking operation, and should NOT be used when running on the main thread context.

Examples
use tauri::api::dialog::blocking::FileDialogBuilder;
#[tauri::command]
async fn my_command() {
  let file_path = FileDialogBuilder::new().save_file();
  // do something with the optional file path here
  // the file path is `None` if the user closed the dialog
}

Trait Implementations§

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more