mirror of
https://github.com/restic/restic.git
synced 2026-04-10 23:28:51 +00:00
Add Windows node support.
The syscall.Stat_t doesn't exist on Windows, so it is replaced by an interface, which Windows can fill out, and field access is replaced by function calls. Common Unix functionality is put into "node_unix.go", so there is less boilerplate. Symlinks are skipped on Windows, since they require admin privileges.
This commit is contained in:
@@ -3,7 +3,6 @@ package restic
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (node *Node) OpenForReading() (*os.File, error) {
|
||||
@@ -14,15 +13,10 @@ func (node *Node) OpenForReading() (*os.File, error) {
|
||||
return file, err
|
||||
}
|
||||
|
||||
func (node *Node) fillTimes(stat *syscall.Stat_t) {
|
||||
node.ChangeTime = time.Unix(stat.Ctim.Unix())
|
||||
node.AccessTime = time.Unix(stat.Atim.Unix())
|
||||
}
|
||||
|
||||
func changeTime(stat *syscall.Stat_t) time.Time {
|
||||
return time.Unix(stat.Ctim.Unix())
|
||||
}
|
||||
|
||||
func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespec) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s statUnix) atim() syscall.Timespec { return s.Atim }
|
||||
func (s statUnix) mtim() syscall.Timespec { return s.Mtim }
|
||||
func (s statUnix) ctim() syscall.Timespec { return s.Ctim }
|
||||
|
||||
Reference in New Issue
Block a user