Commit 6fd3151e authored by Francois-Rene Rideau's avatar Francois-Rene Rideau
Browse files

Workaround duplicate entries returned by clisp for (directory-files "~/")

parent ffe14b71
...@@ -166,6 +166,7 @@ Try to override the defaults to not resolving symlinks, if implementation allows ...@@ -166,6 +166,7 @@ Try to override the defaults to not resolving symlinks, if implementation allows
"Given ENTRIES in a DIRECTORY, remove if the directory is logical "Given ENTRIES in a DIRECTORY, remove if the directory is logical
the entries which are physical yet when transformed by MERGER have a different TRUENAME. the entries which are physical yet when transformed by MERGER have a different TRUENAME.
This function is used as a helper to DIRECTORY-FILES to avoid invalid entries when using logical-pathnames." This function is used as a helper to DIRECTORY-FILES to avoid invalid entries when using logical-pathnames."
(remove-duplicates ;; on CLISP, querying ~/ will return duplicates
(if (logical-pathname-p directory) (if (logical-pathname-p directory)
;; Try hard to not resolve logical-pathname into physical pathnames; ;; Try hard to not resolve logical-pathname into physical pathnames;
;; otherwise logical-pathname users/lovers will be disappointed. ;; otherwise logical-pathname users/lovers will be disappointed.
...@@ -181,7 +182,9 @@ This function is used as a helper to DIRECTORY-FILES to avoid invalid entries wh ...@@ -181,7 +182,9 @@ This function is used as a helper to DIRECTORY-FILES to avoid invalid entries wh
;; but isn't quite in CLISP, for it doesn't have :version :newest ;; but isn't quite in CLISP, for it doesn't have :version :newest
(and u (equal (truename* u) (truename* f)) u))) (and u (equal (truename* u) (truename* f)) u)))
:when p :collect p) :when p :collect p)
entries)) entries)
:test 'pathname-equal))
(defun directory-files (directory &optional (pattern *wild-file*)) (defun directory-files (directory &optional (pattern *wild-file*))
"Return a list of the files in a directory according to the PATTERN, "Return a list of the files in a directory according to the PATTERN,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment