[Ecls-list] patch for RENAME-FILE, was open :supersede and rename-file advise

Geo Carncross geocar at gmail.com
Mon Nov 26 21:22:37 UTC 2007


On Nov 26, 2007 2:33 PM, Geo Carncross <geocar at gmail.com> wrote:
> I'd also be happy locating all of the necessary changes inside
> RENAME-FILE by giving it :IF-EXISTS and :IF-DOES-NOT-EXIST keys that
> chose the appropriate logic. Paired with a SI:POSIX-FSYNC routine,
> this'd allow me to avoid the FFI on ECL, although it wouldn't be
> *quite* so elegant (IMO) from lisp-space.

Included is a patch to cl_rename_file (CL:RENAME-FILE) that adds a
:IF-EXISTS key with the following semantics:

:IF-EXISTS :ERROR (the default) an error is signaled if the new-name
already exists
:IF-EXISTS NIL the file is not overwritten, but RENAME-FILE returns
NIL if new-name already exists
:IF-EXISTS :SUPERSEDE or :IF-EXISTS T if new-name exists, the file is clobbered

The original semantics were similar to :IF-EXISTS :SUPERSEDE except on
Windows where it was possible that RENAME-FILE could delete both
files.

I should note that OpenMCL has a RENAME-FILE that works similarly.

This patch is also available via the web at:

http://geocar.googlepages.com/ecl-ext-rename-file.patch

If accepted, a future patch to src/c/file.d and src/h/object.h could
use cl_rename_file() to handle the :SUPERSEDE case in a crashproof
fashion.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecl-ext-rename-file.patch
Type: text/x-patch
Size: 3531 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20071126/944f4b73/attachment.bin>


More information about the ecl-devel mailing list