(sb!unix:unix-stat filename)
(declare (ignore ino nlink gid rdev size atime
#!+win32 uid))
+ #!+win32
+ ;; On win32, stat regards UNC pathnames and device names as
+ ;; nonexisting, so we check once more with the native API.
+ (unless existsp
+ (setf existsp
+ (let ((handle (sb!win32:create-file
+ filename 0 0 nil
+ sb!win32:file-open-existing
+ 0 0)))
+ (when (/= -1 handle)
+ (setf mode
+ (or mode
+ (if (logbitp 4
+ (sb!win32:get-file-attributes filename))
+ sb!unix:s-ifdir 0)))
+ (progn (sb!win32:close-handle handle) t)))))
(if existsp
(case query-for
(:existence (nth-value
plaforms the stream remains open, allowing IO to continue: the OS resources
associated with the deleted file remain available till the stream is closed as
per standard Unix unlink() behaviour."
- (let* ((pathname (translate-logical-pathname file))
+ (let* ((pathname (translate-logical-pathname
+ (merge-pathnames file (sane-default-pathname-defaults))))
(namestring (native-namestring pathname :as-file t)))
- (truename file) ; for error-checking side-effect
#!+win32
(when (streamp file)
(close file))
\(DELETE-DIRECTORY \"/tmp/foo\") and \(DELETE-DIRECTORY \"/tmp/foo/\") both
delete the \"foo\" subdirectory of \"/tmp\", or signal an error if it does not
-exist or is a file.
-
-Experimental: interface subject to change."
+exist or is a file."
(declare (type pathname-designator pathspec))
(with-pathname (pathname pathspec)
(let ((truename (truename (translate-logical-pathname pathname))))
;;; This is our core directory access interface that we use to implement
;;; DIRECTORY.
(defun map-directory (function directory &key (files t) (directories t)
- (classify-symlinks) (errorp t))
+ (classify-symlinks t) (errorp t))
#!+sb-doc
"Map over entries in DIRECTORY. Keyword arguments specify which entries to
map over, and how:
pathname. Defaults to T.
:CLASSIFY-SYMLINKS
- If T, the decision to call FUNCTION with the pathname of a symbolic link
+ If true, the decision to call FUNCTION with the pathname of a symbolic link
depends on the resolution of the link: if it points to a directory, it is
considered a directory entry, otherwise a file entry. If false, all
- symbolic links are considered file entries. Defaults to T. In both cases
- the pathname used for the symbolic link is not fully resolved, but names it
- as an immediate child of DIRECTORY.
+ symbolic links are considered file entries. In both cases the pathname used
+ for the symbolic link is not fully resolved, but names it as an immediate
+ child of DIRECTORY. Defaults to T.
:ERRORP
If true, signal an error if DIRECTORY does not exist, cannot be read, etc.
((or (null one) (eq one :unspecific)) two)
((or (null two) (eq two :unspecific)) one)
((string= one two) one)
- (t nil)))
+ (t (return-from pathname-intersections nil))))
(intersect-directory (one two)
(aver (typep one '(or null (member :wild :unspecific) list)))
(aver (typep two '(or null (member :wild :unspecific) list)))