Is This A Directory Or A File?
When compiling ReasonML natively, we have access to a variety of additional modules including the Unix
module. We can interact with directories and files using functions on Unix
.
Here we open the current working directory, grab the first thing out of that directory -- maybe it's a file, maybe it's a directory, maybe it is something else. Lastly, we close the directory.
There are a variety of kinds of files to switch on. Here, we are switching on Regular Files, Directories, Links, and Sockets. Everything else falls through.
See the Unix
module docs for more details.
Last updated