[Ecls-list] Any support for a default load path list?

Juan Jose Garcia-Ripoll worm at arrakis.es
Mon Jun 30 06:05:17 UTC 2003


On Monday 30 June 2003 13:51, Dave Pearson wrote:
> Does ecl have any sort of support for a default load path list? That is,
> can I configure some sort of list of directories that ecl should look into
> if I attempt to load a file (or require a module) and it isn't in the
> current directory?
> I have looked at the docs but couldn't find anything.

There is no such facility by default. It could be easily implemented, though 
(Unchecked function with ugly indentation due KMail follows)

(defvar *load-search-path* '(#P"./"))

(defun load-with-search (pathname &key if-does-not-exist &rest args)
   (let ((a-pathname pathname))
     (dolist (paths *load-search-path*
                 ;; This signals an error if the user wanted it to happen.
                 ;; We use this hack because LOAD knows the right type
                 ;; of error to signal
                 (apply #'load a-pathname rest))
          ;; This tries to load a file where the directory might have
          ;; been taken from *LOAD-SEARCH-PATH*. This will
          ;; fail if the file does not exist or the user does not have
          ;; the right permissions. If so, we continue to scan *L-S-P*.
          (setq a-pathname (merge-pathnames pathname paths))
          (when (apply #'load a-pathname :if-does-not-exist nil rest)
              (return-from load-and-search a-pathname))))

Does it fit your needs? How do the other lisps behave?

Juanjo




More information about the ecl-devel mailing list