#![cfg_attr(any(not(feature = "std"), target_arch = "riscv64"), no_std)] #[cfg(all(feature = "std", not(target_arch = "riscv64")))] pub fn main() { use bffs::{dir::Dir, io::Read, Fat32FileSystem, ReadSeek}; let file = std::fs::File::open("disk.img").unwrap(); let fs = Fat32FileSystem::new(file).unwrap(); // println!("{:#?}", fs); // walk(fs.root_directory()); let mut f = fs.open_file("/usr/bin/test_pic").unwrap(); let mut content = Vec::new(); f.read_to_end(&mut content).unwrap(); println!("file content len: {}", content.len()); pub fn walk(dir: Dir<'_, T>) { for entry in dir.iter() { let entry = entry.unwrap(); println!("file {}", entry.name().unwrap()); if entry.is_dir() { walk(entry.to_dir()) } else { let mut file = entry.to_file(); let mut content = String::new(); file.read_to_string(&mut content).unwrap(); println!("file content {}", content); } } } } #[cfg(any(not(feature = "std"), target_arch = "riscv64"))] pub fn main() {}