Raymond Toy pushed to branch issue-157-directory-returns-all-files at cmucl / cmucl
Commits:
- 
c3cd7841
by Raymond Toy at 2023-03-04T09:51:45-08:00
 
2 changed files:
Changes:
| ... | ... | @@ -786,10 +786,6 @@ | 
| 786 | 786 |    (let ((name (%pathname-name pathname))
 | 
| 787 | 787 |  	(type (%pathname-type pathname))
 | 
| 788 | 788 |  	(version (%pathname-version pathname)))
 | 
| 789 | -    #+nil
 | 
|
| 790 | -    (progn
 | 
|
| 791 | -      (format t "name, type = ~A ~A~%" name type)
 | 
|
| 792 | -      (describe pathname))
 | 
|
| 793 | 789 |      (cond ((member name '(nil :unspecific))
 | 
| 794 | 790 |  	   (when (or (not verify-existence)
 | 
| 795 | 791 |  		     (unix:unix-file-kind directory))
 | 
| ... | ... | @@ -803,15 +799,11 @@ | 
| 803 | 799 |  		 (dir-path (pathname directory)))
 | 
| 804 | 800 |  	     (when dir
 | 
| 805 | 801 |  	       (unwind-protect
 | 
| 806 | -		    (loop
 | 
|
| 802 | +		   (loop
 | 
|
| 807 | 803 |  		     (let ((file (unix:read-dir dir)))
 | 
| 808 | 804 |  		       (if file
 | 
| 809 | 805 |  			   (unless (or (string= file ".")
 | 
| 810 | 806 |  				       (string= file ".."))
 | 
| 811 | -			     #+nil
 | 
|
| 812 | -			     (progn
 | 
|
| 813 | -			       (format t "file = ~A~%" file)
 | 
|
| 814 | -			       (describe pathname))
 | 
|
| 815 | 807 |  			     ;; Use pathname-match-p so that we are
 | 
| 816 | 808 |  			     ;; guaranteed to have directory and
 | 
| 817 | 809 |  			     ;; pathname-match-p behave consistently.
 | 
| ... | ... | @@ -820,27 +812,7 @@ | 
| 820 | 812 |  			       (funcall function
 | 
| 821 | 813 |  					(concatenate 'string
 | 
| 822 | 814 |  						     directory
 | 
| 823 | -						     file)))
 | 
|
| 824 | -			     #+nil
 | 
|
| 825 | -			     (multiple-value-bind
 | 
|
| 826 | -				   (file-name file-type file-version)
 | 
|
| 827 | -				 (let ((*ignore-wildcards* t))
 | 
|
| 828 | -				   (extract-name-type-and-version
 | 
|
| 829 | -				    file 0 (length file)))
 | 
|
| 830 | -			       ;; Match also happens if the file has
 | 
|
| 831 | -			       ;; no explicit version and we're asking
 | 
|
| 832 | -			       ;; for version :NEWEST, since that's
 | 
|
| 833 | -			       ;; what no version means.
 | 
|
| 834 | -			       (when (and (components-match file-name name)
 | 
|
| 835 | -					  (components-match file-type type)
 | 
|
| 836 | -					  (or (components-match file-version
 | 
|
| 837 | -								version)
 | 
|
| 838 | -					      (and (eq file-version nil)
 | 
|
| 839 | -						   (eq version :newest))))
 | 
|
| 840 | -				 (funcall function
 | 
|
| 841 | -					  (concatenate 'string
 | 
|
| 842 | -						       directory
 | 
|
| 843 | -						       file)))))
 | 
|
| 815 | +						     file))))
 | 
|
| 844 | 816 |  			   (return))))
 | 
| 845 | 817 |  		 (unix:close-dir dir)))))
 | 
| 846 | 818 |  	  (t
 | 
| ... | ... | @@ -1222,10 +1222,6 @@ a host-structure or string." | 
| 1222 | 1222 |  (defun %%pathname-match-p (pathname wildname)
 | 
| 1223 | 1223 |    (macrolet ((frob (field &optional (op 'components-match ))
 | 
| 1224 | 1224 |  	       `(,op (,field pathname) (,field wildname))))
 | 
| 1225 | -    #+nil
 | 
|
| 1226 | -    (progn
 | 
|
| 1227 | -      (describe pathname)
 | 
|
| 1228 | -      (describe wildname))
 | 
|
| 1229 | 1225 |      (and (or (null (%pathname-host wildname))
 | 
| 1230 | 1226 |  	     (eq (%pathname-host wildname) (%pathname-host pathname)))
 | 
| 1231 | 1227 |  	 (flet ((device-components-match (thing wild)
 | 
| ... | ... | @@ -1236,15 +1232,13 @@ a host-structure or string." | 
| 1236 | 1232 |  		      (or (and (null thing) (eq wild :unspecific))
 | 
| 1237 | 1233 |  			  (and (eq thing :unspecific) (eq wild nil))))))
 | 
| 1238 | 1234 |  	   (frob %pathname-device device-components-match))
 | 
| 1239 | -	 #+nil
 | 
|
| 1240 | -	 (frob %pathname-device)
 | 
|
| 1241 | 1235 |  	 (frob %pathname-directory directory-components-match)
 | 
| 1242 | 1236 |  	 (frob %pathname-name)
 | 
| 1243 | 1237 |  	 (frob %pathname-type)
 | 
| 1244 | 1238 |  	 (flet ((version-components-match (thing wild)
 | 
| 1245 | 1239 |  		  (or (eq thing wild)
 | 
| 1246 | 1240 |  		      (eq wild :wild)
 | 
| 1247 | -		      ;; A version component matches of :newest matches nil.
 | 
|
| 1241 | +		      ;; A version component of :newest matches nil.
 | 
|
| 1248 | 1242 |  		      (compare-version-component thing wild))))
 | 
| 1249 | 1243 |  	   (frob %pathname-version version-components-match)))))
 | 
| 1250 | 1244 |