[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(rename-file "a" "b") fails if b exists
- To: clisp-list@ma2s2.mathematik.uni-karlsruhe.de
- Subject: (rename-file "a" "b") fails if b exists
- From: Robert Morris <rtm@uun.org>
- Date: Sun, 10 Mar 1996 10:57:51 -0500 (EST)
If I call (rename-file "a" "b") in clisp-1995-12-08, and file b
exists, clisp raises an error:
*** - RENAME-FILE: File #"/usr/rtm/clisp-1995-12-08/src/b" already exists
And there doesn't seem to be a way to suppress it: no :if-exists :supersede.
CLTL1 doesn't specify that this should be an error. I want rename to
work in this situation so I can update files without risking losing
them if the system crashes. For instance, the following can be
interrupted at any time and real-file will contain either new or old
data, but not just be truncated:
(with-open-file (s "temporary-file" :direction :outout)
...
(finish-output s))
(rename-file "temporary-file" "real-file")
But this doesn't work in clisp.
People who want the existing behaviour of rename-file can test if the
target file exists first.