mirror of
https://github.com/octoleo/restic.git
synced 2024-12-27 04:32:40 +00:00
Merge pull request #1327 from fawick/fix-1294
Create missing lock dir when saving lock
This commit is contained in:
commit
2db4ff168a
@ -124,6 +124,16 @@ func (b *Local) Save(ctx context.Context, h restic.Handle, rd io.Reader) (err er
|
||||
return err
|
||||
}
|
||||
|
||||
if h.Type == restic.LockFile {
|
||||
lockDir := b.Dirname(h)
|
||||
if !dirExists(lockDir) {
|
||||
debug.Log("locks/ does not exist yet, creating now.")
|
||||
if err := fs.MkdirAll(lockDir, backend.Modes.Dir); err != nil {
|
||||
return errors.Wrap(err, "MkdirAll")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
filename := b.Filename(h)
|
||||
|
||||
// create new file
|
||||
|
Loading…
Reference in New Issue
Block a user