0.7.1.18:
[sbcl.git] / src / cold / shared.lisp
index 7fcb851..b2dc290 100644 (file)
 ;;; COMPILE-STEM function above. -- WHN 19990321
 (defun rename-file-a-la-unix (x y)
 
-  ;; CLISP signals an error when the target file exists, which
-  ;; seems unjustified by the ANSI definition of RENAME-FILE.
-  ;; Work around it.
-  #+clisp (ignore-errors (delete-file y))
-
-  (rename-file x
-              ;; (Note that the TRUENAME expression here is lifted
-              ;; from an example in the ANSI spec for TRUENAME.)
-              (with-open-file (stream y :direction :output)
-                (close stream)
-                ;; From the ANSI spec: "In this case, the file is
-                ;; closed when the truename is tried, so the truename
-                ;; information is reliable."
-                (truename stream))))
+  (let ((path   ;; (Note that the TRUENAME expression here is lifted from an
+                ;; example in the ANSI spec for TRUENAME.)
+        (with-open-file (stream y :direction :output)
+          (close stream)
+          ;; From the ANSI spec: "In this case, the file is closed
+          ;; when the truename is tried, so the truename
+          ;; information is reliable."
+          (truename stream))))
+    (delete-file path)
+    (rename-file x path)))
 (compile 'rename-file-a-la-unix)
 
 ;;; a wrapper for compilation/assembly, used mostly to centralize