rust-fatfs/examples/sample.rs

19 lines
496 B
Rust
Raw Normal View History

2017-09-23 05:20:06 +08:00
extern crate rustfat;
use std::fs::File;
use std::io::BufReader;
use std::str;
use rustfat::FatFileSystem;
fn main() {
let file = File::open("resources/fat12.img").unwrap();
let buf_rdr = BufReader::new(file);
let mut fs = FatFileSystem::new(Box::new(buf_rdr)).unwrap();
2017-09-23 05:20:06 +08:00
let mut root_dir = fs.root_dir();
let entries = root_dir.list().unwrap();
2017-09-23 05:20:06 +08:00
for e in entries {
println!("{} - size {} - modified {}", e.get_name(), e.get_size(), e.get_modify_time());
}
}