From: Chris Hanson Date: Fri, 1 Mar 1996 07:46:00 +0000 (+0000) Subject: When deleting files, determine whether a file is a directory using X-Git-Tag: 20090517-FFI~5686 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=673bf96bc8149a5e3be3ccb85e6c7a3bbd97ebc0;p=mit-scheme.git When deleting files, determine whether a file is a directory using `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. --- diff --git a/v7/src/edwin/dired.scm b/v7/src/edwin/dired.scm index c4b884a2b..26191d887 100644 --- a/v7/src/edwin/dired.scm +++ b/v7/src/edwin/dired.scm @@ -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?