[Issue 3862] std.file.copy does not have the same behavior as cp

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Nov 21 22:24:20 PST 2015


https://issues.dlang.org/show_bug.cgi?id=3862

--- Comment #14 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
(In reply to Vladimir Panteleev from comment #12)
> (In reply to Jonathan M Davis from comment #11)
> > @Vladimir Well, clearly you and I have very different expectations when
> > copying files.
> 
> You haven't addressed any of the arguments I brought up.

I can see some corner cases where your concerns would be a problem, but in
general, cp does exactly what I want, and having to do a bunch of additional
checks is just annoying. And while I can definitely believe that there are
programs where race conditions would be a concern or where it could be
problematic to assume that the target is a directory, I've never personally
written or worked on a program where that was a concern.

(In reply to Vladimir Panteleev from comment #13)
> I just looked at Python, and it provides both variants. We could introduce
> "copyTo" which works in the same way, and perhaps also require that the path
> ends with a directory separator for the "copy inside directory" behavior to
> activate.

Requiring a terminating directory separator would be annoying, but having
separate functions where one requires that the target be a file and the other
is more liberal does make sense.

--


More information about the Digitalmars-d-bugs mailing list