Browse Source

Fixed file-explorer example

pull/107/head
Andrea Ciliberti 2 years ago
parent
commit
082d9933b9
  1. 11
      ctru-rs/examples/file-explorer.rs

11
ctru-rs/examples/file-explorer.rs

@ -162,17 +162,16 @@ impl<'a> FileExplorer<'a> {
fn get_input_and_run(&mut self, action: impl FnOnce(&mut Self, String)) { fn get_input_and_run(&mut self, action: impl FnOnce(&mut Self, String)) {
let mut keyboard = Swkbd::default(); let mut keyboard = Swkbd::default();
let mut new_path_str = String::new();
match keyboard.get_utf8(&mut new_path_str) { match keyboard.write_to_string() {
Ok(Button::Right) => { Ok((path, Button::Right)) => {
// Clicked "OK" // Clicked "OK"
action(self, new_path_str); action(self, path);
} }
Ok(Button::Left) => { Ok((_, Button::Left)) => {
// Clicked "Cancel" // Clicked "Cancel"
} }
Ok(Button::Middle) => { Ok((_, Button::Middle)) => {
// This button wasn't shown // This button wasn't shown
unreachable!() unreachable!()
} }

Loading…
Cancel
Save