From 46ca6064c3485b489f2ee1517d19ce32aa5c84c3 Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Wed, 27 Dec 2023 21:01:54 -0500 Subject: [PATCH] well it is at least a wip --- src/bel_1_1.mp4 | 1 + src/src/main.rs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 120000 src/bel_1_1.mp4 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() }