Re: copy-file behavior

Sam Steingold <[email protected]> Fri, 10 Nov 2017 12:05:05 -0500
Newsgroups gmane.lisp.clisp.general
Message-ID <[email protected]>
> * Don Cohen <[email protected]> [2017-11-10 14:51:11 +0000]:
>
> It seems strange to me that copy-file adds a file extension
> to the destination:
>
> [1]> (copy-file "/home/don/2014.05.18.rr.sep.xE.xls" "/tmp/foo")
> ((#P"/home/don/2014.05.18.rr.sep.xE.xls" #P"/tmp/foo.xls" 75938))
>
> And, not surprisingly, there is no file named /tmp/foo now, but
> there is one named /tmp/foo.xls instead.
>
> This isn't mentioned in impnotes.

This was an oversight.
Please see
https://clisp.sourceforge.io/beta/impnotes/syscalls.html#copy-file

> Is it intended?  What's the justification?

Yes, clisp/modules/syscalls/calls.c:copy_one_file() calls
MERGE-PATHNAMES on source and destination so that one can use a
directory-only destination.
Copying extension is, IMO, generally useful too because most desktop
environments use it to decide what to do with a file.

> How can I get the destination I asked for?

Make source file name without type (extension):

--8<---------------cut here---------------start------------->8---
(copy-file (make-pathname :directory '(:absolute "home" "don")
                          :name "2014.05.18.rr.sep.xE.xls" :type nil)
           "/tmp/foo")
--8<---------------cut here---------------end--------------->8---

Thanks.

-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504
http://steingoldpsychology.com http://www.childpsy.net http://mideasttruth.com
https://jihadwatch.org http://www.dhimmitude.org https://ffii.org
My suicidal thoughts are killing me.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
clisp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-list