lucasfernog / rfd

Rusty File Dialog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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!

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

Diference bettwen MacOS Windowed App and MacOS NonWindowed App

  • Macos async dialog requires an 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 recomended to spawn dialogs on main thread, RFD can run dialogs from any thread but it is only posible in windowed app and it adds a lite bit of overhead. So it is recomended 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

About

Rusty File Dialog


Languages

Language:Rust 99.3%Language:CSS 0.7%