chiark / gitweb /
safely.lisp: SAFE-COPY shouldn't make two copies under CLisp.
[lisp] / safely.lisp
index 13671a4698df327efcfc59696ff305559e4ca991..9b4ab451bf5e293d707914eabc20864a1b29906f 100644 (file)
@@ -112,8 +112,10 @@ (defun safely-open-output-stream (safe file &rest open-args)
 
 (declaim (inline rename))
 (defun rename (old new)
-  #-clisp (rename-file old 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."
@@ -179,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