Fix no_std build
This commit is contained in:
parent
7a53215a57
commit
69b7675940
@ -240,9 +240,9 @@ impl <'a, T: ReadWriteSeek + 'a> Dir<'a, T> {
|
|||||||
// check if directory contains no files
|
// check if directory contains no files
|
||||||
for r in self.iter() {
|
for r in self.iter() {
|
||||||
let e = r?;
|
let e = r?;
|
||||||
let name = e.file_name();
|
let name = e.short_file_name_bytes();
|
||||||
// ignore special entries "." and ".."
|
// ignore special entries "." and ".."
|
||||||
if name != "." && name != ".." {
|
if name != ".".as_bytes() && name != "..".as_bytes() {
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
use core::cmp;
|
use core::cmp;
|
||||||
use core::char;
|
use core::char;
|
||||||
|
use core::iter::FromIterator;
|
||||||
use io::prelude::*;
|
use io::prelude::*;
|
||||||
use io::{Error, ErrorKind, SeekFrom};
|
use io::{Error, ErrorKind, SeekFrom};
|
||||||
use io;
|
use io;
|
||||||
@ -13,10 +14,7 @@ use dir_entry::DIR_ENTRY_SIZE;
|
|||||||
use table::{ClusterIterator, alloc_cluster, read_fat_flags, count_free_clusters};
|
use table::{ClusterIterator, alloc_cluster, read_fat_flags, count_free_clusters};
|
||||||
|
|
||||||
#[cfg(all(not(feature = "std"), feature = "alloc"))]
|
#[cfg(all(not(feature = "std"), feature = "alloc"))]
|
||||||
use alloc::{String, string::ToString};
|
use alloc::String;
|
||||||
#[cfg(all(not(feature = "std"), not(feature = "alloc")))]
|
|
||||||
use core::str;
|
|
||||||
use core::iter::FromIterator;
|
|
||||||
|
|
||||||
// FAT implementation based on:
|
// FAT implementation based on:
|
||||||
// http://wiki.osdev.org/FAT
|
// 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 {
|
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}' }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user