use std::path::{Path, PathBuf};
#[derive(Debug)]
pub(crate) struct NativeFile {
path: PathBuf,
}
impl From<PathBuf> for NativeFile {
fn from(path: PathBuf) -> Self {
Self { path }
}
}
impl egui::DroppedFile for NativeFile {
fn path(&self) -> &Path {
&self.path
}
fn bytes(&self) -> Result<Vec<u8>, String> {
std::fs::read(&self.path).map_err(|err| err.to_string())
}
}