- "Stringify and downcase NAME if it is a symbol, then attempt to load
- the file $SBCL_HOME/name/name"
- (let ((name (if (symbolp name) (string-downcase (symbol-name name)) name)))
- (load
- (merge-pathnames (make-pathname :directory (list :relative name)
- :name name)
- (truename (posix-getenv "SBCL_HOME")))))
- (provide name))
-
-
+ "Stringify and downcase NAME, then attempt to load the file
+ $SBCL_HOME/name/name"
+ (let* ((filesys-name (string-downcase (string name)))
+ (unadorned-path
+ (merge-pathnames
+ (make-pathname :directory (list :relative filesys-name)
+ :name filesys-name)
+ (truename (posix-getenv "SBCL_HOME"))))
+ (fasl-path (merge-pathnames
+ (make-pathname :type *fasl-file-type*)
+ unadorned-path))
+ (lisp-path (merge-pathnames (make-pathname :type "lisp")
+ unadorned-path)))
+ ;; KLUDGE: there's a race condition here; the file we probe could
+ ;; be removed by the time we get round to trying to load it.
+ ;; Maybe factor out the logic in the LOAD guesser as to which file
+ ;; was meant, so that we can use it here on open streams instead?
+ (when (or (probe-file unadorned-path)
+ (probe-file fasl-path)
+ (probe-file lisp-path))
+ (load unadorned-path)
+ t)))