mirror of https://github.com/restic/restic.git
restore: Make sure target directory exists
This commit is contained in:
parent
9acc9243ba
commit
92421ec47f
|
@ -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 New Issue