Files
ThothII/tools/thothctl/internal/pi/durable_windows.go
T

16 lines
580 B
Go

//go:build windows
package pi
import "golang.org/x/sys/windows"
// MoveFileEx requests replacement and write-through on Windows. Directory fsync is not exposed
// by the Windows API in the same form as Unix, so callers must not claim a stronger guarantee.
func durableReplace(temporary, target, _ string) error {
from, err := windows.UTF16PtrFromString(temporary)
if err != nil { return err }
to, err := windows.UTF16PtrFromString(target)
if err != nil { return err }
return windows.MoveFileEx(from, to, windows.MOVEFILE_REPLACE_EXISTING|windows.MOVEFILE_WRITE_THROUGH)
}