22 lines
594 B
Go
22 lines
594 B
Go
//go:build windows
|
|
|
|
package archive
|
|
|
|
import "golang.org/x/sys/windows"
|
|
|
|
func atomicReplace(from, to string) error {
|
|
fromUTF16, err := windows.UTF16PtrFromString(from)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
toUTF16, err := windows.UTF16PtrFromString(to)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return windows.MoveFileEx(fromUTF16, toUTF16, windows.MOVEFILE_REPLACE_EXISTING|windows.MOVEFILE_WRITE_THROUGH)
|
|
}
|
|
|
|
// Windows has no portable directory fsync operation. MoveFileEx with
|
|
// MOVEFILE_WRITE_THROUGH provides the strongest supported replacement flush.
|
|
func syncDirectory(string) error { return nil }
|