BUGFIX: Collision works better, not 100%
BUGFIX: Video Reset works.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use std::ffi::OsString;
|
||||
use gemma::constants::CHIP8_KEYBOARD;
|
||||
use std::fs::File;
|
||||
use std::fs::{File, read_dir};
|
||||
use std::io::Read;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::time::Duration;
|
||||
@@ -23,16 +24,23 @@ impl GuiFileList {
|
||||
pub fn display_path(root: PathBuf, selected_filename: &String, ui: &Ui) -> String {
|
||||
let mut working_filename = selected_filename.clone();
|
||||
ui.text(format!("Displaying {}", root.to_str().unwrap_or("Unable to parse path")));
|
||||
for (index, entry) in std::fs::read_dir(root.as_path()).unwrap().enumerate() {
|
||||
let filename = entry.unwrap().file_name();
|
||||
let filename = filename.to_str().unwrap();
|
||||
let mut working_select = ui.selectable_config(format!("{}", filename));
|
||||
if filename == selected_filename {
|
||||
|
||||
let mut known_files: Vec<OsString> = vec![];
|
||||
|
||||
for entry in read_dir(root.as_path()).unwrap() {
|
||||
known_files.push(entry.unwrap().file_name());
|
||||
}
|
||||
|
||||
known_files.sort();
|
||||
|
||||
for (index, entry) in known_files.iter().enumerate() {
|
||||
let mut working_select = ui.selectable_config(format!("{}", entry.clone().into_string().unwrap()));
|
||||
if entry.to_str().unwrap().to_string() == selected_filename.as_str().to_string() {
|
||||
working_select = working_select.selected(true);
|
||||
}
|
||||
if working_select.build() {
|
||||
debug!("SELECTED {index} / {filename}");
|
||||
working_filename = filename.to_string();
|
||||
debug!("SELECTED {index} / {entry:?}");
|
||||
working_filename = entry.clone().into_string().unwrap();
|
||||
};
|
||||
}
|
||||
working_filename
|
||||
|
||||
Reference in New Issue
Block a user