mirror of
https://github.com/octoleo/restic.git
synced 2024-11-23 05:12:10 +00:00
Make check for non-existing paths OS independent.
This commit is contained in:
parent
35bd8f80c0
commit
73de59a615
@ -4,7 +4,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/restic/restic/backend"
|
"github.com/restic/restic/backend"
|
||||||
"github.com/restic/restic/debug"
|
"github.com/restic/restic/debug"
|
||||||
@ -96,9 +95,7 @@ func (res *Restorer) restoreNodeTo(node *Node, dir string, dst string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Did it fail because of ENOENT?
|
// Did it fail because of ENOENT?
|
||||||
if pe, ok := errors.Cause(err).(*os.PathError); ok {
|
if err != nil && os.IsNotExist(errors.Cause(err)) {
|
||||||
errn, ok := pe.Err.(syscall.Errno)
|
|
||||||
if ok && errn == syscall.ENOENT {
|
|
||||||
debug.Log("Restorer.restoreNodeTo", "create intermediate paths")
|
debug.Log("Restorer.restoreNodeTo", "create intermediate paths")
|
||||||
|
|
||||||
// Create parent directories and retry
|
// Create parent directories and retry
|
||||||
@ -107,7 +104,6 @@ func (res *Restorer) restoreNodeTo(node *Node, dir string, dst string) error {
|
|||||||
err = node.CreateAt(dstPath, res.repo)
|
err = node.CreateAt(dstPath, res.repo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
debug.Log("Restorer.restoreNodeTo", "error %v", err)
|
debug.Log("Restorer.restoreNodeTo", "error %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user