diff --git a/src/bel_1_1.mp4 b/src/bel_1_1.mp4 new file mode 120000 index 0000000..ec8ad75 --- /dev/null +++ b/src/bel_1_1.mp4 @@ -0,0 +1 @@ +/Users/breel/Movies/bel_1_1.mp4 \ No newline at end of file diff --git a/src/src/main.rs b/src/src/main.rs index 8ad7541..06f932d 100644 --- a/src/src/main.rs +++ b/src/src/main.rs @@ -1,7 +1,7 @@ #![allow(non_snake_case)] // import the prelude to get access to the `rsx!` macro and the `Scope` and `Element` types use dioxus::prelude::*; -use nfd; +use rfd::AsyncFileDialog; fn main() { // launch the dioxus app in a webview @@ -22,6 +22,17 @@ fn App(cx: Scope) -> Element { input { r#type: "button", value: "pick file", onclick: move |evt| { + to_owned![file]; + async move { + match AsyncFileDialog::new() + .pick_file() + .await { + Some(f) => { + file.set(f.file_name().clone()); // TODO swap to .path() on desktop + }, + None => { file.set(format!("<>")); }, + }; + } }, }, p { file.get().clone() }