X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/lisp/blobdiff_plain/469805e3cd7d17e70de6b668aae1fc32a1413265..1a50efd8a9e976bf16a29ce381ea38c6b9a39ea1:/safely.lisp diff --git a/safely.lisp b/safely.lisp index 69fceed..9b4ab45 100644 --- a/safely.lisp +++ b/safely.lisp @@ -112,10 +112,10 @@ (defun safely-open-output-stream (safe file &rest open-args) (declaim (inline rename)) (defun rename (old new) - #-clisp (rename-file old - (make-pathname :directory '(:relative) - :defaults new)) - #+clisp (posix:copy-file old new :method :rename)) + (let ((target (make-pathname :directory '(:relative) + :defaults new))) + #-clisp (rename-file old target) + #+clisp (rename-file old target :if-exists :overwrite))) (defun delete-file-without-moaning (file) "Delete the FILE, ignoring errors." @@ -181,9 +181,7 @@ (defun safe-copy (file tag) :method :hardlink :if-exists nil))) - - - #-(or cmu sbcl) + #-(or cmu sbcl clisp) ;; Otherwise just copy the file contents and hope for the best. (with-open-file (input file :element-type :default) (multiple-value-bind