Raymond Toy pushed to branch master at cmucl / cmucl

Commits:

4 changed files:

Changes:

  • src/code/exports.lisp
    ... ... @@ -1213,7 +1213,8 @@
    1213 1213
     
    
    1214 1214
     	     "INVALID-FASL"
    
    1215 1215
     	     "WITH-TEMPORARY-DIRECTORY"
    
    1216
    -	     "WITH-TEMPORARY-FILE")
    
    1216
    +	     "WITH-TEMPORARY-FILE"
    
    1217
    +	     "DELETE-DIRECTORY")
    
    1217 1218
       ;; gencgc features
    
    1218 1219
       #+gencgc
    
    1219 1220
       (:export "GET-GC-ASSERTIONS"
    

  • src/code/extensions.lisp
    ... ... @@ -673,9 +673,9 @@
    673 673
     (defun delete-directory (dirname &key recursive)
    
    674 674
       _N"Delete the directory Dirname.  If the Recursive is non-NIL,
    
    675 675
       recursively delete the directory Dirname including all files and
    
    676
    -  subdirectories. Dirname must be a pathname to a directory.  Any NAME
    
    677
    -  or TYPE components in Dirname are ignored."
    
    678
    -  (declare (type pathname dirname))
    
    676
    +  subdirectories. Dirname must name a directory.  Any NAME or TYPE
    
    677
    +  components in Dirname are ignored.  A FILE-ERROR is signaled if any
    
    678
    +  directory cannot be deleted."
    
    679 679
       (when recursive
    
    680 680
         ;; Find all the files or directories in DIRNAME.
    
    681 681
         (dolist (path (directory (merge-pathnames "*.*" dirname)))
    
    ... ... @@ -685,8 +685,15 @@
    685 685
     	  (delete-directory path :recursive t)
    
    686 686
     	  (delete-file path))))
    
    687 687
       ;; Finally delete the directory.
    
    688
    -  (unix:unix-rmdir (namestring dirname))
    
    689
    -  (values))
    
    688
    +  (multiple-value-bind (ok errno)
    
    689
    +      (unix:unix-rmdir (namestring dirname))
    
    690
    +    (unless ok
    
    691
    +      (error 'kernel:simple-file-error
    
    692
    +	     :pathname dirname
    
    693
    +	     :format-control (intl:gettext "Could not remove directory \"~A\": ~A.")
    
    694
    +	     :format-arguments (list dirname
    
    695
    +				     (unix:get-unix-error-msg errno))))
    
    696
    +    ok))
    
    690 697
     
    
    691 698
     
    
    692 699
     ;;; WITH-TEMPORARY-DIRECTORY  -- Public
    

  • src/i18n/locale/cmucl.pot
    ... ... @@ -6011,8 +6011,13 @@ msgstr ""
    6011 6011
     msgid ""
    
    6012 6012
     "Delete the directory Dirname.  If the Recursive is non-NIL,\n"
    
    6013 6013
     "  recursively delete the directory Dirname including all files and\n"
    
    6014
    -"  subdirectories. Dirname must be a pathname to a directory.  Any NAME\n"
    
    6015
    -"  or TYPE components in Dirname are ignored."
    
    6014
    +"  subdirectories. Dirname must name a directory.  Any NAME or TYPE\n"
    
    6015
    +"  components in Dirname are ignored.  A FILE-ERROR is signaled if any\n"
    
    6016
    +"  directory cannot be deleted."
    
    6017
    +msgstr ""
    
    6018
    +
    
    6019
    +#: src/code/extensions.lisp
    
    6020
    +msgid "Could not remove directory \"~A\": ~A."
    
    6016 6021
     msgstr ""
    
    6017 6022
     
    
    6018 6023
     #: src/code/extensions.lisp
    

  • tests/pathname.lisp
    ... ... @@ -144,14 +144,13 @@
    144 144
           (assert-equal dir-tilde dir-home))))
    
    145 145
     
    
    146 146
     (define-test delete-directory
    
    147
    -  (let ((dir (ensure-directories-exist "tmp/a/b/c/")))
    
    148
    -    ;; Verify that the directories were created.
    
    149
    -    (assert-equal "tmp/a/b/c/"
    
    150
    -		  dir)
    
    151
    -    ;; Try to delete the directory.  It should fail, which we verify
    
    152
    -    ;; by noting the directory listing is not empty.
    
    153
    -    (ext::delete-directory (pathname "tmp/"))
    
    154
    -    (assert-true (directory "tmp/"))
    
    155
    -    ;; Now recursively delete the directory.
    
    156
    -    (ext::delete-directory (pathname "tmp/") :recursive t)
    
    157
    -    (assert-false (directory "tmp/"))))
    147
    +  (:tag :issues)
    
    148
    +  (ext:with-temporary-directory (path)
    
    149
    +    (let ((dir (ensure-directories-exist (merge-pathnames "tmp/a/b/c/" path))))
    
    150
    +      ;; Try to delete the directory.  It should fail..
    
    151
    +      (assert-error 'kernel:simple-file-error
    
    152
    +		    (ext:delete-directory (merge-pathnames "tmp/" path)))
    
    153
    +      ;; Now recursively delete the directory.
    
    154
    +      (assert-true (ext:delete-directory (merge-pathnames "tmp/" path)
    
    155
    +					 :recursive t))
    
    156
    +      (assert-false (directory "tmp/")))))