(export '(system::*module-path* system::create-module-path) "SYSTEM") (defvar *module-path* nil) (defun require (name &optional (path (string name))) (let ((name (string name)) (pathlist (if (listp path) path (list path)))) (unless (member name *modules* :test #'equal) (dolist (pathname pathlist) (let ((rpath (find-require-file pathname))) (if rpath (load rpath) (load pathname :if-does-not-exist nil))))))) (defun find-require-file (path) (let ((type (pathname-type path))) (dolist (dir *module-path*) (let ((p (merge-pathnames path dir))) (cond ((eq (system::file-type p) :directory) (let* ((dl (append (pathname-directory p) (list (pathname-name p)))) (d (make-pathname :directory dl :device (pathname-device p) :host (pathname-host p))) (ap (merge-pathnames "_autoidx" d))) (when (or (probe-file (merge-pathnames ap ".lsp")) (probe-file (merge-pathnames ap ".fsl"))) (return ap)))) (type (when (probe-file p) (return p))) ((or (probe-file (merge-pathnames p ".lsp")) (probe-file (merge-pathnames p ".fsl"))) (return p)) ((probe-file p) (return p))))))) (defun create-module-path () (list (make-pathname :directory '(:relative)) *default-path* (merge-pathnames (make-pathname :directory '(:relative "Examples")) *default-path*)))