Files
shop-crm-agent/internal/config/replace_windows.go
T

22 lines
424 B
Go
Raw Normal View History

//go:build windows
package config
import "golang.org/x/sys/windows"
func replaceFile(source, target string) error {
sourcePath, err := windows.UTF16PtrFromString(source)
if err != nil {
return err
}
targetPath, err := windows.UTF16PtrFromString(target)
if err != nil {
return err
}
return windows.MoveFileEx(
sourcePath,
targetPath,
windows.MOVEFILE_REPLACE_EXISTING|windows.MOVEFILE_WRITE_THROUGH,
)
}