- ;; 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)))