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

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Nov 3 12:20:03 PST 2015


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

Andrei Alexandrescu <andrei at erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #7 from Andrei Alexandrescu <andrei at erdani.com> ---
(In reply to Vladimir Panteleev from comment #6)
> We definitely DO NOT want to match the behavior of cp. cp is a tool
> primarily aimed to be used directly by humans, hence some of its DWIM
> behavior and common human mistake checks. std.file.copy is a function which
> will always be used as part of a larger, more complicated program.
> 
> For example, copying a file into the subdirectory if the destination path is
> a directory is something that would, IMO, violate the principle of least
> surprise. In most circumstances, the program will know if the destination
> path should be a file or directory (assuming it exists), and the programmer
> can write the intended behavior anyway. If the program expects that the
> destination path doesn't exist or is a file, but is in fact a directory,
> then putting the file inside the directory is definitely not something the
> programmer should need to foresee and take into account for.
> 
> What we could draw comparisons with is how other programming languages'
> standard libraries do it. At this point, it might be too late to change the
> behavior of std.file.copy at all.

That to me spells "let's close this". Obliged.

--


More information about the Digitalmars-d-bugs mailing list