Ignore LFN and fix handling of extension in filename.

Fixes fat12 and fat16 tests. Fat32 still doesnt work.
This commit is contained in:
Rafał Harabień 2017-09-23 21:29:11 +02:00
parent 8df86d24ef
commit c65d26bd2b

View File

@ -50,7 +50,9 @@ fn convert_date_time(dos_date: u16, dos_time: u16) -> DateTime<Local> {
impl FatDirEntry {
pub fn get_name(&self) -> String {
str::from_utf8(&self.name).unwrap().trim_right().to_string()
let name = str::from_utf8(&self.name[0..8]).unwrap().trim_right();
let ext = str::from_utf8(&self.name[8..11]).unwrap().trim_right();
if ext == "" { name.to_string() } else { format!("{}.{}", name, ext) }
}
pub fn get_attrs(&self) -> FatFileAttributes {
@ -103,6 +105,9 @@ impl FatDir {
if entry.name[0] == 0xE5 {
continue; // deleted
}
if entry.attrs == FatFileAttributes::LFN {
continue; // FIXME: support LFN
}
entries.push(entry);
}