FileExists implements restore.Output interface.
(_ context.Context, relativePath string, e fs.File)
| 188 | |
| 189 | // FileExists implements restore.Output interface. |
| 190 | func (o *FilesystemOutput) FileExists(_ context.Context, relativePath string, e fs.File) bool { |
| 191 | st, err := os.Lstat(filepath.Join(o.TargetPath, relativePath)) |
| 192 | if err != nil { |
| 193 | return false |
| 194 | } |
| 195 | |
| 196 | if (st.Mode() & os.ModeType) != 0 { |
| 197 | // not a file |
| 198 | return false |
| 199 | } |
| 200 | |
| 201 | if st.Size() != e.Size() { |
| 202 | // wrong size |
| 203 | return false |
| 204 | } |
| 205 | |
| 206 | timeDelta := st.ModTime().Sub(e.ModTime()) |
| 207 | if timeDelta < 0 { |
| 208 | timeDelta = -timeDelta |
| 209 | } |
| 210 | |
| 211 | return timeDelta < maxTimeDeltaToConsiderFileTheSame |
| 212 | } |
| 213 | |
| 214 | // CreateSymlink implements restore.Output interface. |
| 215 | func (o *FilesystemOutput) CreateSymlink(ctx context.Context, relativePath string, e fs.Symlink) error { |