Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual filesystem support? #190

Open
dbalsom opened this issue Nov 17, 2024 · 2 comments
Open

Virtual filesystem support? #190

dbalsom opened this issue Nov 17, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@dbalsom
Copy link

dbalsom commented Nov 17, 2024

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

@fluxxcode
Copy link
Owner

fluxxcode commented Nov 17, 2024

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 🤔

@fluxxcode fluxxcode added the enhancement New feature or request label Nov 17, 2024
@dbalsom
Copy link
Author

dbalsom commented Nov 21, 2024

Actually if we use the wasm-unknown-emscripten target, we should get the emscripten virtual filesystem for free, as it implements the std::fs interface.

Still would be nice for mounted disk images, though.

I cobbled together my own little file browser for disk images, it's not nearly as pretty:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants