Use Win32 API atomic replace in replace_file
The changes to enable Windows support in replace_file were not actually
complete, and it didn't work when the file didn't exist - because of
limitations of the emulation done on our side, rather than anything else.
Windows has a bunch of quirks, and Ruby doesn't actually abstract over the
underlying platform a great deal. We can use the Windows API ReplaceFile, and
MoveFileEx, to achieve the desired behaviour though.
This adds even more conditional code inside the replace_file method to
handle multiple platforms - but it really isn't very clean. Better to get
this working now, then refactor, though.
Cherry pick of: 73e302bbf5ab4a6c5513a39070e2c907542775ae
Conflicts:
lib/puppet/util.rb
spec/unit/util_spec.rb