There are several different ways to accomplish what (I think) you are trying to do, but eventually they all boil down to letting Chez know where to look for things. When given relative paths, include
and load
use the source-directories
parameter to search for the requested file. Libraries have their path automatically prepended to source-directories
while they are being loaded or compiled, so if your main.scm
were a library definition then it would find util.scm
as you expect.
However, it sounds like main.scm
isn't a library, it's a top-level program. Unfortunately, Chez doesn't have a command line option to set the source-directories
like it does for library directories. That leaves you with a bit less flexibility. Any of the following will work:
- Make
util.scm
a library and invoke Chez with the --libdirs
option to let it know where to look for libraries.
- Set
source-directories
and load main.scm
from inside the REPL rather than from the command line.
- Write a wrapper shell script that does the above by echoing the commands into
scheme
so you don't have to type it yourself. (Only suitable if you don't also need to then type into the scheme session).
- Write a wrapper shell script that
cd
s into your project directory before running scheme
(and presumably cd
s back to the original directory when it's done).