Pascal Bourguignon wrote:
> On 22 août 07, at 16:00, Sam Steingold wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>> Magnus Henoch wrote:
>>> I'm trying to rename a directory with CLISP (from CVS HEAD, on
>>> NetBSD/powerpc). However, RENAME-FILE doesn't do what I want:
>>> > (rename-file "/tmp/foo/" "/tmp/bar/")
>>> *** - no file name given: #P"/tmp/foo/"
>>> > (rename-file "/tmp/foo" "/tmp/bar")
>>> *** - RENAME-FILE: "/tmp/foo" names a directory, not a file
>>> Is that a bug or a feature? Should I use some other function?
>> CLISP has traditionally taken the position that "file" and "directory"
>> are disjoint categories, so, if a function operates on "files", it
>> should reject "directories".
>> e.g., in CLISP, PROBE-FILE does not work on directories, while
>> EXT:PROBE-DIRECTORY does not work on files (those who want one probe
>> function, can use DIRECTORY).
>> in the case of RENAME-FILE, there is no function RENAME-DIRECTORY,
>> so we
>> either need to make the former work on directories, or add the latter.
>> what is the better option?
> To stay in the tradition, RENAME-DIRECTORY.
> The only downside, is that the current platforms are all more or less
> POSIX, where a directory "is a" file, so people would expect to use the
> same functions on files and directories.
> Still, I think that EXT:RENAME-DIRECTORY would be better, because
> has some special treatment of its arguments that might not be
> indicated for
An alternative (but which is more work), would be to have a more complete POSIX package, including POSIX functions such as mkdir(3) and rename(3). But it may be slightly less in the spirit of clisp of providing lispy features: RENAME-DIRECTORY would work even on non posix platforms ;-)