BeginDirectory implements restore.Output interface.
(_ context.Context, relativePath string, d fs.Directory)
| 24 | |
| 25 | // BeginDirectory implements restore.Output interface. |
| 26 | func (o *TarOutput) BeginDirectory(_ context.Context, relativePath string, d fs.Directory) error { |
| 27 | if relativePath == "" { |
| 28 | return nil |
| 29 | } |
| 30 | |
| 31 | h := &tar.Header{ |
| 32 | Name: relativePath + "/", |
| 33 | ModTime: d.ModTime(), |
| 34 | Mode: int64(d.Mode()), |
| 35 | Uid: int(d.Owner().UserID), |
| 36 | Gid: int(d.Owner().GroupID), |
| 37 | Typeflag: tar.TypeDir, |
| 38 | } |
| 39 | |
| 40 | if err := o.tf.WriteHeader(h); err != nil { |
| 41 | return errors.Wrap(err, "error writing tar header") |
| 42 | } |
| 43 | |
| 44 | return nil |
| 45 | } |
| 46 | |
| 47 | // FinishDirectory implements restore.Output interface. |
| 48 | // |