Page 1 of 1

load problem

Posted: Sat Mar 17, 2012 2:48 am
by nico92
Hello
I have a problem with the load and require functions.
If the directory dir2 is in the dir1 directory, and if in the dir2 directory, I have two files: file1.lisp and file2.lisp, and if I put (load "file2.lisp") in file1.lisp:
If I run from dir1: clisp dir2/file1.lisp, then I get an error.
It is the same if I use require instead of load.
How can I fix it?

In other words, I have a program made of several files, with one which loads the others. I would like not to have to run this one from the directory where it is.

Re: load problem

Posted: Sat Mar 17, 2012 6:28 am
by ramarren
The proper way is to use a system definition facility like ASDF. Otherwise you have to use MERGE-PATHNAMES to create a full pathname to the file you want to load, either by using saved absolute path or *LOAD-PATHNAME* variable. But that might break if anything is file-compiled.