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

Vladimir Panteleev <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
                 CC|                            |[email protected]

--- Comment #6 from Vladimir Panteleev <[email protected]> ---
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.

--

Reply via email to