From 6499d9253f834f5888bb2ade66cf8f20544fa433 Mon Sep 17 00:00:00 2001
From: Sven Emtell <sven.emtell@doremir.com>
Date: Tue, 25 Oct 2022 21:45:37 +0200
Subject: [PATCH] Follow symbolic links in LispWorks 8 and newer

---
 quicklisp/impl-util.lisp | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/quicklisp/impl-util.lisp b/quicklisp/impl-util.lisp
index 0b0743d..616b17e 100644
--- a/quicklisp/impl-util.lisp
+++ b/quicklisp/impl-util.lisp
@@ -247,9 +247,15 @@ quicklisp at CL startup."
     (directory (merge-pathnames *wild-entry* directory)
                #+scl :truenamep #+scl nil))
   (:implementation lispworks
-    (directory (merge-pathnames *wild-entry* directory)
-               #+lispworks :directories #+lispworks t
-               #+lispworks :link-transparency #+lispworks nil))
+   ;; In LispWorks 8.0 and newer, if the file-namestring of pathname is a symbolic link pointing
+   ;; to a directory and link-transparency is nil, then directory returns it as a file.
+   #-(or lispworks4 lispworks5 lispworks6 lispworks7)
+   (when (hcl:file-link-p directory)
+     (setf directory (make-pathname :directory (append (pathname-directory directory)
+                                                       (list (file-namestring directory))))))
+   (directory (merge-pathnames *wild-entry* directory)
+              #+lispworks :directories #+lispworks t
+              #+lispworks :link-transparency #+lispworks nil))
   (:implementation ecl
     (nconc
      (directory (merge-pathnames *wild-entry* directory)