Open dbalsom opened 6 hours ago
This is a really interesting idea, but also relatively complicated to implement.
My first idea would also be a FileSystem trait. Something like:
trait FileSystem {
fn read_dir(path: &str) -> Result<DirectoryContent>;
fn read_file(path: &str) -> Result<DirectoryEntry>;
}
struct DirectoryContent {
content: Vec<DirectoryEntry>,
}
struct DirectoryEntry {
modify_date: SystemTime,
data: Vec<u8>,
type: <Enum for File/Directory>,
}
That is at least a first idea without having given it much thought.
With something like this it might also be possible to implement wasm support 🤔
This isn't really an issue so much as a feature proposal...
I work with disk images in my emulator - and they have FAT file systems, and those filesystems could use a file browser.
It would be cool if this could work with a virtual filesystem. I'm not sure how exactly it would work, maybe some sort of FileSystem trait interface?
This could also perhaps enable it to work with emscripten's MEMFS virtual filesystem as well. https://emscripten.org/docs/porting/files/file_systems_overview.html