aboutsummaryrefslogtreecommitdiff
path: root/examples/file_selection.rs
blob: 5d2d860e48425b32f80cc2d081d54c843b064d48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright (C) 2019 Robin Krahl <robin.krahl@ireas.org>
// SPDX-License-Identifier: MIT

use dialog::DialogBox;

fn main() -> dialog::Result<()> {
    let choice = dialog::FileSelection::new("Please select a file")
        .title("File Chooser Example (Open)")
        .path("/etc")
        .show()?;
    println!("The user chose: {:?}", choice);

    let choice = dialog::FileSelection::new("Please select a file")
        .title("File Chooser Example (Save)")
        .mode(dialog::FileSelectionMode::Save)
        .path("/etc")
        .show()?;
    println!("The user chose: {:?}", choice);

    Ok(())
}