Changeset 14619
- Timestamp:
- 01/30/14 14:10:03 (10 years ago)
- Location:
- trunk/abcl/src/org/armedbear/lisp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/Pathname.java
r14601 r14619 1565 1565 private static final Primitive LIST_DIRECTORY = new pf_list_directory(); 1566 1566 @DocString(name="list-directory", 1567 args="directory &optional (resolve-symlinks t)",1567 args="directory &optional (resolve-symlinks nil)", 1568 1568 returns="pathnames", 1569 1569 doc="Lists the contents of DIRECTORY, optionally resolving symbolic links.") … … 1577 1577 } 1578 1578 @Override 1579 public LispObject execute(LispObject arg, LispObject arg2) {1579 public LispObject execute(LispObject arg, LispObject resolveSymlinks) { 1580 1580 Pathname pathname = coerceToPathname(arg); 1581 1581 if (pathname instanceof LogicalPathname) { … … 1642 1642 File file = files[i]; 1643 1643 Pathname p; 1644 if (file.isDirectory()) { 1645 if (arg2 != NIL) { 1646 p = Pathname.getDirectoryPathname(file); 1647 } else { 1648 p = new Pathname(file.getAbsolutePath()); 1649 } 1650 } else { 1651 if (arg2 != NIL) { 1652 p = new Pathname(file.getCanonicalPath()); 1653 } else { 1654 p = new Pathname(file.getAbsolutePath()); 1655 } 1656 } 1644 String path; 1645 if (resolveSymlinks == NIL) { 1646 path = file.getAbsolutePath(); 1647 } else { 1648 path = file.getCanonicalPath(); 1649 } 1650 URI pathURI = (new File(path)).toURI(); 1651 p = new Pathname(pathURI.toString()); 1657 1652 result = new Cons(p, result); 1658 1653 } -
trunk/abcl/src/org/armedbear/lisp/directory.lisp
r14176 r14619 97 97 entries)))))) 98 98 99 ;;; XXX Kludge for compatibilty: hope no one uses. 100 (defun directory-old (pathspec &key (resolve-symlinks t)) 101 (warn "Deprecated: Please use CL:DIRECTORY which has a NIL default for :RESOLVE-SYMLINKS.") 102 (directory pathspec :resolve-symlinks resolve-symlinks)) 99 103 100 (defun directory (pathspec &key (resolve-symlinks t)) 104 (defun directory (pathspec &key (resolve-symlinks nil)) 105 "Determines which, if any, files that are present in the file system have names matching PATHSPEC, and returns 106 a fresh list of pathnames corresponding to the potential truenames of those files. 107 108 With :RESOLVE-SYMLINKS set to nil, not all pathnames returned may 109 correspond to an existing file. Symbolic links are considered to be 110 be valid entries even if they do not currently have a valid file or 111 directory as a target. Therefore, subsequent CL:TRUENAME call on 112 individual pathnames in the list may signal an error, i.e. the 113 pathnames have been constructed as truenames, without calling the 114 entire resolution routine of CL:TRUENAME. 115 116 If called with :RESOLVE-SYMLINKS set to T, and any of the pathnames 117 have truenames which do not exist, this routine will signal a file 118 error to its caller." 119 101 120 (let ((pathname (merge-pathnames pathspec))) 102 121 (when (logical-pathname-p pathname) … … 116 135 (matching-entries ())) 117 136 (dolist (entry entries) 118 (cond ((file-directory-p entry) 119 (when (pathname-match-p (file-namestring (pathname-as-file entry)) (file-namestring pathname)) 120 (push (truename entry) matching-entries))) 121 ((pathname-match-p (or (file-namestring entry) "") (file-namestring pathname)) 122 (push (truename entry) matching-entries)))) 137 (when 138 (or 139 (and 140 (file-directory-p entry) 141 (pathname-match-p (file-namestring (pathname-as-file entry)) 142 (file-namestring pathname))) 143 (pathname-match-p (or (file-namestring entry) "") (file-namestring pathname))) 144 (push 145 (if resolve-symlinks 146 (truename entry) 147 entry) 148 matching-entries))) 123 149 matching-entries)))) 124 150 ;; Not wild.
Note: See TracChangeset
for help on using the changeset viewer.