Changeset 15369


Ignore:
Timestamp:
08/21/20 15:38:51 (2 years ago)
Author:
Mark Evenson
Message:

Change CL:DIRECTORY to use CL:PATHNAME-MATCH-P

CL:DIRECTORY was only matching on the name and type portions of a file
which was just wrong.

Fix the internally used SYS::COMPONENT-MATCH-WILD-P to work on
wildcards constisting of only #\* characters.

<https://abcl.org/trac/ticket/472>

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/directory.lisp

    r14921 r15369  
    9797                     entries)))))
    9898
     99;;; The extension to ANSI via :RESOLVE-SYMLINKS was added as
     100;;; <https://abcl.org/trac/ticket/340>, in which it was argued that
     101;;; symlinks should be considered contents of a directory, and that in
     102;;; any event, performing a DIRECTORY on a dangling symlink should not
     103;;; signal an error.
     104;;;
     105;;; See <https://abcl.org/trac/changeset/14624> for additional
     106;;; information on implementation decision.
    99107(defun directory (pathspec &key (resolve-symlinks nil))
    100108  "Determines which, if any, files that are present in the file system have names matching PATHSPEC, and returns a fresh list of pathnames corresponding to the potential truenames of those files. 
     
    133141                (let ((entries (list-directories-with-wildcards
    134142                                namestring nil resolve-symlinks))
    135                       (matching-entries ()))
     143                      matching-entries)
    136144                  (dolist (entry entries)
    137                     (when
    138                         (or
    139                          (and
    140                           (file-directory-p entry :wild-error-p nil)
    141                           (pathname-match-p (file-namestring (pathname-as-file entry))
    142                                             (file-namestring pathname)))
    143                          (pathname-match-p (or (file-namestring entry) "")
    144                                            (file-namestring pathname)))
     145                    (when (pathname-match-p entry pathname)
    145146                      (push
    146147                       (if resolve-symlinks
  • trunk/abcl/src/org/armedbear/lisp/pathnames.lisp

    r15107 r15369  
    5656    (labels ((split-string (delim str)
    5757         (flet ((finder (char) (find char delim)))
    58      (loop  for x = (position-if-not #'finder str) then
    59           (position-if-not #'finder str :start (or y (length str)))
    60         for y = (position-if #'finder str :start x) then
    61           (position-if #'finder str :start (or x (length str))) while x
    62         collect (subseq str x y))))
     58     (loop
     59                   :for x = (position-if-not #'finder str)
     60                     :then (position-if-not #'finder str :start (or y (length str)))
     61       :for y = (position-if #'finder str :start (or x (length str)))
     62                     :then (position-if #'finder str :start (or x (length str)))
     63                   :while x
     64        :collect (subseq str x y))))
    6365       (positions-larger (thing substrings previous-pos)
    6466         (let ((new-pos (search (car substrings)
Note: See TracChangeset for help on using the changeset viewer.