forked from TrueCloudLab/restic
fs: Simplify NodeCreateAt
This commit is contained in:
parent
e10e2bb50f
commit
19653f9e06
1 changed files with 10 additions and 22 deletions
|
@ -163,41 +163,29 @@ func lookupGroup(gid uint32) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeCreateAt creates the node at the given path but does NOT restore node meta data.
|
// NodeCreateAt creates the node at the given path but does NOT restore node meta data.
|
||||||
func NodeCreateAt(node *restic.Node, path string) error {
|
func NodeCreateAt(node *restic.Node, path string) (err error) {
|
||||||
debug.Log("create node %v at %v", node.Name, path)
|
debug.Log("create node %v at %v", node.Name, path)
|
||||||
|
|
||||||
switch node.Type {
|
switch node.Type {
|
||||||
case restic.NodeTypeDir:
|
case restic.NodeTypeDir:
|
||||||
if err := nodeCreateDirAt(node, path); err != nil {
|
err = nodeCreateDirAt(node, path)
|
||||||
return err
|
|
||||||
}
|
|
||||||
case restic.NodeTypeFile:
|
case restic.NodeTypeFile:
|
||||||
if err := nodeCreateFileAt(path); err != nil {
|
err = nodeCreateFileAt(path)
|
||||||
return err
|
|
||||||
}
|
|
||||||
case restic.NodeTypeSymlink:
|
case restic.NodeTypeSymlink:
|
||||||
if err := nodeCreateSymlinkAt(node, path); err != nil {
|
err = nodeCreateSymlinkAt(node, path)
|
||||||
return err
|
|
||||||
}
|
|
||||||
case restic.NodeTypeDev:
|
case restic.NodeTypeDev:
|
||||||
if err := nodeCreateDevAt(node, path); err != nil {
|
err = nodeCreateDevAt(node, path)
|
||||||
return err
|
|
||||||
}
|
|
||||||
case restic.NodeTypeCharDev:
|
case restic.NodeTypeCharDev:
|
||||||
if err := nodeCreateCharDevAt(node, path); err != nil {
|
err = nodeCreateCharDevAt(node, path)
|
||||||
return err
|
|
||||||
}
|
|
||||||
case restic.NodeTypeFifo:
|
case restic.NodeTypeFifo:
|
||||||
if err := nodeCreateFifoAt(path); err != nil {
|
err = nodeCreateFifoAt(path)
|
||||||
return err
|
|
||||||
}
|
|
||||||
case restic.NodeTypeSocket:
|
case restic.NodeTypeSocket:
|
||||||
return nil
|
err = nil
|
||||||
default:
|
default:
|
||||||
return errors.Errorf("filetype %q not implemented", node.Type)
|
err = errors.Errorf("filetype %q not implemented", node.Type)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func nodeCreateDirAt(node *restic.Node, path string) error {
|
func nodeCreateDirAt(node *restic.Node, path string) error {
|
||||||
|
|
Loading…
Reference in a new issue