Commit 6138d709 authored by Robert Goldman's avatar Robert Goldman
Browse files

Neil Lindholm DIRECTORY-FILES fix.

Neil found that the pathname argument would be misinterpreted if it was a directory pathname without a trailing slash.
Applied his fix and added a test.
parent 3daffc26
......@@ -318,9 +318,16 @@
(assert (probe-file* (subpathname *build-directory* "deleteme/a/b/2")))
(DBG "check to make sure DIRECTORY-FILES doesn't list subdirectories")
(let ((directory-a (directory-files (subpathname *build-directory* "deleteme/a/")))
(directory-b (directory-files (subpathname *build-directory* "deleteme/a/b/"))))
(directory-a-no-slash (directory-files (subpathname *build-directory* "deleteme/a")))
(directory-b (directory-files (subpathname *build-directory* "deleteme/a/b/")))
(directory-b-no-slash (directory-files (subpathname *build-directory* "deleteme/a/b"))))
(assert-pathnames-equal directory-a (list (subpathname *build-directory* "deleteme/a/1.x")))
(assert-pathnames-equal directory-b (list (subpathname *build-directory* "deleteme/a/b/2"))))
(DBG "check to make sure DIRECTORY-FILES checks its parameter for directory pathname")
(let ((directory-a-no-slash (directory-files (subpathname *build-directory* "deleteme/a")))
(directory-b-no-slash (directory-files (subpathname *build-directory* "deleteme/a/b"))))
(assert-pathnames-equal directory-a-no-slash (list (subpathname *build-directory* "deleteme/a/1.x")))
(assert-pathnames-equal directory-b-no-slash (list (subpathname *build-directory* "deleteme/a/b/2"))))
(DBG "check to make sure SUBDIRECTORIES does list subdirectories")
(let ((directory-a (subdirectories (subpathname *build-directory* "deleteme/a/")))
(directory-b (subdirectories (subpathname *build-directory* "deleteme/a/b/"))))
......@@ -209,7 +209,7 @@ Subdirectories should NOT be returned.
override the default at your own risk.
DIRECTORY-FILES tries NOT to resolve symlinks if the implementation permits this,
but the behavior in presence of symlinks is not portable. Use IOlib to handle such situations."
(let ((dir (pathname directory)))
(let ((dir (ensure-directory-pathname directory)))
(when (logical-pathname-p dir)
;; Because of the filtering we do below,
;; logical pathnames have restrictions on wild patterns.
Supports Markdown
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