1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-02 16:43:28 +00:00

local: add Metadata support #111

This commit is contained in:
Nick Craig-Wood
2022-05-24 18:06:16 +01:00
parent 22abd785eb
commit c556e98f49
15 changed files with 699 additions and 6 deletions

View File

@@ -0,0 +1,28 @@
//go:build windows
// +build windows
package local
import (
"os"
"time"
"syscall"
)
const haveSetBTime = true
// setBTime sets the the birth time of the file passed in
func setBTime(name string, btime time.Time) (err error) {
h, err := syscall.Open(name, os.O_RDWR, 0755)
if err != nil {
return err
}
defer func() {
closeErr := syscall.Close(h)
if err == nil {
err = closeErr
}
}()
bFileTime := syscall.NsecToFiletime(btime.UnixNano())
return syscall.SetFileTime(h, &bFileTime, nil, nil)
}