Re: design question, why not always use 'cp --remove-destination'?
From:
Paul Eggert
Subject:
Re: design question, why not always use 'cp --remove-destination'?
Date:
Tue, 22 Aug 2006 12:29:24 -0700
User-agent:
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)
Frederik Eaton <address@hidden> writes:
> is there a reason why users wouldn't always want a "copyFile"
> function to remove the destination first?
Lots and lots and lots of reasons. For example, the destination file
might be read-only, and the user might want the copy to fail in that
case. A copyFile that first removed the destination would mistakenly
succeed on a read-only destination.
Another example: "cp infile /dev/null". Replacing /dev/null with a
regular file is a bad idea, in my experience. (And I have experience. :-)
This may help to explain why Unix does not have a standard copy_file
function. Copying a file is harder than it looks, and there are lots
of options. Good luck with your attempt to simplify things for Haskell.