|
@@ -9,18 +9,17 @@ import (
|
|
|
// setCTime will set the create time on a file. On Windows, this requires
|
|
|
// calling SetFileTime and explicitly including the create time.
|
|
|
func setCTime(path string, ctime time.Time) error {
|
|
|
- ctimespec := windows.NsecToTimespec(ctime.UnixNano())
|
|
|
- pathp, e := windows.UTF16PtrFromString(path)
|
|
|
- if e != nil {
|
|
|
- return e
|
|
|
+ pathp, err := windows.UTF16PtrFromString(path)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
}
|
|
|
- h, e := windows.CreateFile(pathp,
|
|
|
+ h, err := windows.CreateFile(pathp,
|
|
|
windows.FILE_WRITE_ATTRIBUTES, windows.FILE_SHARE_WRITE, nil,
|
|
|
windows.OPEN_EXISTING, windows.FILE_FLAG_BACKUP_SEMANTICS, 0)
|
|
|
- if e != nil {
|
|
|
- return e
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
}
|
|
|
defer windows.Close(h)
|
|
|
- c := windows.NsecToFiletime(windows.TimespecToNsec(ctimespec))
|
|
|
+ c := windows.NsecToFiletime(ctime.UnixNano())
|
|
|
return windows.SetFileTime(h, &c, nil, nil)
|
|
|
}
|