forked from TrueCloudLab/restic
restore: Make sure target directory exists
This commit is contained in:
parent
9acc9243ba
commit
92421ec47f
1 changed files with 6 additions and 0 deletions
|
@ -197,6 +197,12 @@ func (res *Restorer) RestoreTo(ctx context.Context, dst string) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// make sure the target directory exists
|
||||||
|
err = fs.MkdirAll(dst, 0777) // umask takes care of dir permissions
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "MkdirAll")
|
||||||
|
}
|
||||||
|
|
||||||
idx := restic.NewHardlinkIndex()
|
idx := restic.NewHardlinkIndex()
|
||||||
return res.traverseTree(ctx, dst, string(filepath.Separator), *res.sn.Tree, treeVisitor{
|
return res.traverseTree(ctx, dst, string(filepath.Separator), *res.sn.Tree, treeVisitor{
|
||||||
enterDir: func(node *restic.Node, target, location string) error {
|
enterDir: func(node *restic.Node, target, location string) error {
|
||||||
|
|
Loading…
Reference in a new issue