WriteFile implements restore.Output interface.
(ctx context.Context, relativePath string, f fs.File, progressCb FileWriteProgress)
| 172 | |
| 173 | // WriteFile implements restore.Output interface. |
| 174 | func (o *FilesystemOutput) WriteFile(ctx context.Context, relativePath string, f fs.File, progressCb FileWriteProgress) error { |
| 175 | log(ctx).Debugf("WriteFile %v (%v bytes) %v, %v", filepath.Join(o.TargetPath, relativePath), f.Size(), f.Mode(), f.ModTime()) |
| 176 | path := filepath.Join(o.TargetPath, filepath.FromSlash(relativePath)) |
| 177 | |
| 178 | if err := o.copyFileContent(ctx, path, f, progressCb); err != nil { |
| 179 | return errors.Wrap(err, "error creating file") |
| 180 | } |
| 181 | |
| 182 | if err := o.setAttributes(path, f, os.FileMode(0)); err != nil { |
| 183 | return errors.Wrap(err, "error setting attributes") |
| 184 | } |
| 185 | |
| 186 | return SafeRemoveAll(path) |
| 187 | } |
| 188 | |
| 189 | // FileExists implements restore.Output interface. |
| 190 | func (o *FilesystemOutput) FileExists(_ context.Context, relativePath string, e fs.File) bool { |
nothing calls this directly
no test coverage detected