Sync computers

This commit is contained in:
2026-02-28 18:55:10 +01:00
parent c3eb93e701
commit 9a983c56f3
29 changed files with 1564 additions and 28 deletions

34
crates/bffs/src/main.rs Normal file
View File

@@ -0,0 +1,34 @@
#![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<T: ReadSeek>(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() {}