Is it possible to use multiple file servers?

Erlang has a concept of a “file server” which all file IO requests go through: http://erlang.org/doc/man/file.html

The file server is also responsible for managing the CWD (e.g. via :file.set_cwd/1).

Is there a way to utilize multiple file servers so you could do things like have a different CWD for different processes? I’d like to avoid/minimize the CWD as a source of global mutable state if possible.

I’d guess you can roll your own Supervisor + GenServers with a router/dispatcher, and each GenServer uses raw file access and just copies its results back in its handle_call functions?

The best way to avoid cwd as global state is to not rely on cwd by using absolute paths / relative paths at a single cwd, which is supposed to never change.

CWD is something happening on the OS process level.