I have a project created using leningen in which I've saved clj files in the src/some_project_name directory (alongside the autogenerated core.clj file).
Also saved with these clj files are text files which I want to slurp
from the clj files they live beside. My understanding is that reading files is relative to the working directory, and that the working directory will be wherever you've started the REPL from. I started the REPL from inside src/some_project_name where all the files are located, rather than root. (System/getProperty "user.dir")
confirms this is the active directory.
However I've also read that slurp
will look for files relative to your root directory, which is apparently what is happening despite starting the REPL from within src/some_project_name. I have to list the text file paths relative to the root directory in order for them to be found, e.g. "src/some_project_name/foo.txt" rather than just "foo.txt".
Before setting up a project, files were accessible relative to wherever the REPL was running (as I would expect). Now after setting up a project, they seem to only be accessible relative to root, regardless of where the REPL is started.
I have no problem with this, but I don't understand it. Is there some setup done by leningen that intercepts REPL evaluation and tells it to search from root rather than where the active directory is?