forked from TrueCloudLab/restic
restore symlink timestamps on windows
This commit is contained in:
parent
0d260cfd82
commit
144257f8bd
1 changed files with 15 additions and 1 deletions
|
@ -17,7 +17,21 @@ func lchown(path string, uid int, gid int) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespec) error {
|
func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespec) error {
|
||||||
return nil
|
// tweaked version of UtimesNano from go/src/syscall/syscall_windows.go
|
||||||
|
pathp, e := syscall.UTF16PtrFromString(path)
|
||||||
|
if e != nil {
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
h, e := syscall.CreateFile(pathp,
|
||||||
|
syscall.FILE_WRITE_ATTRIBUTES, syscall.FILE_SHARE_WRITE, nil, syscall.OPEN_EXISTING,
|
||||||
|
syscall.FILE_FLAG_BACKUP_SEMANTICS|syscall.FILE_FLAG_OPEN_REPARSE_POINT, 0)
|
||||||
|
if e != nil {
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
defer syscall.Close(h)
|
||||||
|
a := syscall.NsecToFiletime(syscall.TimespecToNsec(utimes[0]))
|
||||||
|
w := syscall.NsecToFiletime(syscall.TimespecToNsec(utimes[1]))
|
||||||
|
return syscall.SetFileTime(h, nil, &a, &w)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getxattr retrieves extended attribute data associated with path.
|
// Getxattr retrieves extended attribute data associated with path.
|
||||||
|
|
Loading…
Reference in a new issue