Atomicity of file-copying/moving

Andrew Godfrey via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 17 06:20:59 PDT 2017


On Tuesday, 16 May 2017 at 08:32:56 UTC, Nordlöw wrote:
> What's the status of atomicity of file-copying and -moving 
> (renaming) using std.file on different platforms?

For renaming that's a good question, but for copying, no-one 
should make atomicity guarantees. It's inherently non-atomic, and 
if you try to build an atomic wrapper around it (by trying to 
catch failure cases and deleting the file), you'd be ignoring 
cases like power failure, system hang, process crash. Some of 
those could be achieved on some OSes, but I doubt all of them can 
on all OSes.


More information about the Digitalmars-d-learn mailing list