WebAssembly/wasi-filesystem

Requesting file descriptors at runtime

Opened this issue · 0 comments

Preopening file descriptors works well for directories with configuration/data because those directories are known for a given program. It also works fine for short-lived CLI programs because the directories they need are known when the program starts (because they are passed as args). But for long-running programs, like GUI programs, you may not know which files are needed until runtime.

So it would be nice to have an API to allow an application to request one or more fds at runtime. How this is handled would be up to the runtime, but one example option would be for it to open your system's file explorer, similarly to how it works for most GUI programs on modern OSes. For the CLI runtimes, they could for instance request the path(s) through the terminal.

Flatpak's org.freedesktop.portal.FileChooser is prior art in this area. Hopefully it wouldn't be as complex as theirs.