if walkinfo.Mode().IsRegular() {
return copyfile(walkpath, path.Join(cp.bind, walkpath[len(cp.src):]))
} else if walkinfo.Mode().IsDir() {
- // will be visited by Walk()
- return nil
+ return os.MkdirAll(path.Join(cp.bind, walkpath[len(cp.src):]), 0770)
} else {
return fmt.Errorf("Source %q is not a regular file or directory", cp.src)
}
"/tmp/foo": {Kind: "collection",
PortableDataHash: "59389a8f9ee9d399be35462a0f92541c+53",
Writable: true},
+ "/tmp/bar": {Kind: "collection",
+ PortableDataHash: "59389a8f9ee9d399be35462a0f92541d+53",
+ Path: "baz",
+ Writable: true},
}
cr.OutputPath = "/tmp"
os.MkdirAll(realTemp+"/keep1/by_id/59389a8f9ee9d399be35462a0f92541c+53", os.ModePerm)
+ os.MkdirAll(realTemp+"/keep1/by_id/59389a8f9ee9d399be35462a0f92541d+53/baz", os.ModePerm)
+
+ rf, _ := os.Create(realTemp+"/keep1/by_id/59389a8f9ee9d399be35462a0f92541d+53/baz/quux")
+ rf.Write([]byte("bar"))
+ rf.Close()
err := cr.SetupMounts()
c.Check(err, IsNil)
_, err = os.Stat(cr.HostOutputDir + "/foo")
c.Check(err, IsNil)
+ _, err = os.Stat(cr.HostOutputDir + "/bar/quux")
+ c.Check(err, IsNil)
os.RemoveAll(cr.ArvMountPoint)
cr.CleanupDirs()
checkEmpty()