mirror of
https://github.com/octoleo/restic.git
synced 2024-11-11 07:41:03 +00:00
Delete existing path before restoring a symlink
This commit is contained in:
parent
74f7fe2b98
commit
9adaa6e240
@ -299,8 +299,12 @@ func (node Node) createSymlinkAt(path string) error {
|
|||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
err := fs.Symlink(node.LinkTarget, path)
|
|
||||||
if err != nil {
|
if err := os.RemoveAll(path); err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||||
|
return errors.Wrap(err, "Symlink")
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := fs.Symlink(node.LinkTarget, path); err != nil {
|
||||||
return errors.Wrap(err, "Symlink")
|
return errors.Wrap(err, "Symlink")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user