Fix no_std build

This commit is contained in:
Rafał Harabień 2018-06-20 17:28:46 +02:00
parent 7a53215a57
commit 69b7675940
2 changed files with 5 additions and 7 deletions

View File

@ -240,9 +240,9 @@ impl <'a, T: ReadWriteSeek + 'a> Dir<'a, T> {
// check if directory contains no files
for r in self.iter() {
let e = r?;
let name = e.file_name();
let name = e.short_file_name_bytes();
// ignore special entries "." and ".."
if name != "." && name != ".." {
if name != ".".as_bytes() && name != "..".as_bytes() {
return Ok(false);
}
}

View File

@ -1,6 +1,7 @@
use core::cell::RefCell;
use core::cmp;
use core::char;
use core::iter::FromIterator;
use io::prelude::*;
use io::{Error, ErrorKind, SeekFrom};
use io;
@ -13,10 +14,7 @@ use dir_entry::DIR_ENTRY_SIZE;
use table::{ClusterIterator, alloc_cluster, read_fat_flags, count_free_clusters};
#[cfg(all(not(feature = "std"), feature = "alloc"))]
use alloc::{String, string::ToString};
#[cfg(all(not(feature = "std"), not(feature = "alloc")))]
use core::str;
use core::iter::FromIterator;
use alloc::String;
// FAT implementation based on:
// http://wiki.osdev.org/FAT
@ -688,5 +686,5 @@ impl <'a, T: ReadWriteSeek> Seek for DiskSlice<'a, T> {
}
pub(crate) fn decode_oem_char_lossy(oem_char: u8) -> char {
if oem_char < 0x80 { oem_char as char } else { char::REPLACEMENT_CHARACTER }
if oem_char < 0x80 { oem_char as char } else { '\u{FFFD}' }
}