d84914ef1e5a
dropped_path.rs
use std::path::{Path, PathBuf};
use std::sync::Arc;
#[derive(Debug)]
pub struct DroppedPath(PathBuf);
impl egui::DroppedFile for DroppedPath {
fn path(&self) -> &Path {
&self.0
}
fn bytes(&self) -> Result<Vec<u8>, String> {
std::fs::read(&self.0).map_err(|error| error.to_string())
}
}
pub fn handle(path: PathBuf) -> egui::DroppedFileHandle {
Arc::new(DroppedPath(path))
}
No file is open. Choose one in the tree, or press Ctrl+O (⌘O on a Mac) to find one by name.
Syntax highlighting could not load. The unmodified read-only text remains available above.