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:
>>>
>>> [1]> (rename-file "/tmp/foo/" "/tmp/bar/")
>>>
>>> *** - no file name given: #P"/tmp/foo/"
>>>
>>> [3]> (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
> RENAME-FILE
> has some special treatment of its arguments that might not be
> indicated for
> directories.
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 ;-)
Logged In: YES
user_id=5735
Originator: NO
not that given that we already have make-dir and delete-dir, the new function will be called rename-dir
Logged In: YES
user_id=5735
Originator: NO
Thanks for the suggestion - it has been just implemented and
checked into the CVS repository, and will be available in the next
release.
If you cannot wait for the next release, you can get the latest
development sources from the CVS and compile them yourself.
Please be aware that the development sources are not stable and
might not even compile on your machine.
You should report any problems you encounter with the CVS sources
to the <clisp-devel> mailing list, not to the <clisp-list>.
If you use the CVS sources, you should read <clisp-devel>
since the CVS log goes there.