17 releases (5 breaking)

0.5.1 Oct 8, 2021
0.4.4 Aug 30, 2021
0.4.0 May 21, 2021
0.2.2 Mar 26, 2021
0.0.1 Nov 27, 2020

#41 in GUI

Download history 1607/week @ 2021-06-25 1177/week @ 2021-07-02 1402/week @ 2021-07-09 1638/week @ 2021-07-16 1959/week @ 2021-07-23 1814/week @ 2021-07-30 2504/week @ 2021-08-06 3076/week @ 2021-08-13 2794/week @ 2021-08-20 3019/week @ 2021-08-27 2586/week @ 2021-09-03 2654/week @ 2021-09-10 3230/week @ 2021-09-17 4229/week @ 2021-09-24 4229/week @ 2021-10-01 4603/week @ 2021-10-08

11,825 downloads per month
Used in 9 crates (7 directly)

MIT license

98KB
2.5K SLoC

img

version Documentation dependency status

Rusty file dialogs for Windows, Linux (GTK), MacOS And WASM32.

Why RFD?

  • It uses 100% native API on all platforms, it does not spawn any processes in the background.
  • It supports async/await syntax
  • And if one day you decide to port your program to browser, WASM support is there for you!

Dependencies

On Linux:

  • GTK3 development libraries (on debian libgtk-3-dev on arch gtk3)

Example

// Sync Dialog
let files = FileDialog::new()
    .add_filter("text", &["txt", "rs"])
    .add_filter("rust", &["rs", "toml"])
    .set_directory("/")
    .pick_file();

// Async Dialog
let file = AsyncFileDialog::new()
    .add_filter("text", &["txt", "rs"])
    .add_filter("rust", &["rs", "toml"])
    .set_directory("/")
    .pick_file()
    .await;

let data = file.read().await;

State

GitHub Workflow Status

API Stability
🚧
Feature Linux Windows MacOS [1] Wasm32
SingleFile
MultipleFile
PickFolder
SaveFile
Filters
StartingPath
Async

[1] Macos Sync dialog freezes when used with winit (same way as nfd) Caused by winit #1779

Difference between MacOS Windowed App and MacOS NonWindowed App

  • Macos async dialog requires a started NSApplication instance, so dialog is truly async only when opened in windowed env like winit,SDL2, etc. otherwise it will fallback to sync dialog.
  • It is also recommended to spawn dialogs on main thread, RFD can run dialogs from any thread but it is only possible in windowed app and it adds a little bit of overhead. So it is recommended to: spawn on main and await in other thread
  • NonWindowed apps will never be able to spawn dialogs from threads diferent than main
  • NonWindowed apps will never be able to spawn async dialogs

rfd-extras

AKA features that are not file related

Feature Linux Windows MacOS Wasm32
MessageDialog
PromptDialog
ColorPicker

Dependencies

~0–2.6MB
~51K SLoC