When deleting files, determine whether a file is a directory using
authorChris Hanson <org/chris-hanson/cph>
Fri, 1 Mar 1996 07:46:00 +0000 (07:46 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 1 Mar 1996 07:46:00 +0000 (07:46 +0000)
`file-attributes-direct' rather than `file-directory?'.  The latter
will return #t for a symbolic link pointing to a directory, in which
case the deletion will fail.

v7/src/edwin/dired.scm

index c4b884a2be24f18ad909963ae93af11a2ca5ad40..26191d887bbf9221802d61ae0bb452b18b457b35 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: dired.scm,v 1.159 1995/10/31 08:10:19 cph Exp $
+;;;    $Id: dired.scm,v 1.160 1996/03/01 07:46:00 cph Exp $
 ;;;
-;;;    Copyright (c) 1986, 1989-95 Massachusetts Institute of Technology
+;;;    Copyright (c) 1986, 1989-96 Massachusetts Institute of Technology
 ;;;
 ;;;    This material was developed by the Scheme project at the
 ;;;    Massachusetts Institute of Technology, Department of
@@ -912,7 +912,9 @@ Actions controlled by variables list-directory-brief-switches
 
 (define (dired-kill-file! filename lstart)
   (let ((deleted?
-        (if (file-directory? filename)
+        (if (let ((attributes (file-attributes-direct filename)))
+              (and attributes
+                   (eq? #t (file-attributes/type attributes))))
             (delete-directory-no-errors filename)
             (delete-file-no-errors filename))))
     (if deleted?