use fatfs::{DefaultTimeProvider, LossyOemCpConverter, ReadWriteSeek};
pub trait Disk: ReadWriteSeek + Send {
fn is_present(&self) -> bool;
}
impl Disk for std::io::Cursor<Vec<u8>> {
fn is_present(&self) -> bool {
true
}
}
impl Disk for block_client::Cache {
fn is_present(&self) -> bool {
self.device().is_connected()
}
}
pub type FileSystem = fatfs::FileSystem<Box<dyn Disk>, DefaultTimeProvider, LossyOemCpConverter>;
pub type Dir<'a> = fatfs::Dir<'a, Box<dyn Disk>, DefaultTimeProvider, LossyOemCpConverter>;
pub type DirEntry<'a> =
fatfs::DirEntry<'a, Box<dyn Disk>, DefaultTimeProvider, LossyOemCpConverter>;
pub type File<'a> = fatfs::File<'a, Box<dyn Disk>, DefaultTimeProvider, LossyOemCpConverter>;