Popularity
3.9
Stable
Activity
0.0
Stable
149
6
19

Programming language: Rust
License: MIT License
Tags: GUI     Ui     file     dialog    

nfd-rs alternatives and similar packages

Based on the "ncurses" category.
Alternatively, view nfd-rs alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of nfd-rs or a related project?

Add another 'ncurses' Package

README

nfd-rs

nfd-rs is a Rust binding to the library nativefiledialog, that provides a convenient cross-platform interface to opening file dialogs on Linux, OS X and Windows.

This crate has been tested on Mac, Window and Linux (Ubuntu 14.04) and supports single/mutliple and save dialogs, notice APIs may break with newer versions.

Usage

  • Add the dependency nfd in your Cargo.toml

    [dependencies]
    nfd = "0.0.4"
    
  • Open a single file dialog

    extern crate nfd;
    

use nfd::Response;

fn main() {

let result = nfd::open_file_dialog(None, None).unwrap_or_else(|e| {
    panic!(e);
});

match result {
    Response::Okay(file_path) => println!("File path = {:?}", file_path),
    Response::OkayMultiple(files) => println!("Files {:?}", files),
    Response::Cancel => println!("User canceled"),
}

}


* Open a multi file dialog using builder with jpg files as filter
  ```rust
  extern crate nfd;

  use nfd::Response;

  fn main() {

    let result = nfd::dialog_multiple().filter("jpg").open().unwrap_or_else(|e| {
        panic!(e);
    });

    match result {
        Response::Okay(file_path) => println!("File path = {:?}", file_path),
        Response::OkayMultiple(files) => println!("Files {:?}", files),
        Response::Cancel => println!("User canceled"),
    }
  }

Screenshot

[Cocoa on El Capitan](screenshots/cocoa_el_capitan.png?raw=true)


*Note that all licence references and agreements mentioned in the nfd-rs README section above are relevant to that project's source code only.