cpiocat: add AppendDir
This commit is contained in:
@ -157,6 +157,24 @@ func (c *Cat) AppendFile(srcPath, archPath string) (r *Cat) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Cat) AppendDir(archPath string, mode cpio.FileMode) (r *Cat) {
|
||||||
|
r = c
|
||||||
|
if c.err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var err error
|
||||||
|
defer func() { c.err = err }()
|
||||||
|
|
||||||
|
const DIR_FLAG = 0o004 << 12
|
||||||
|
err = c.cout.WriteHeader(&cpio.Header{
|
||||||
|
Name: archPath,
|
||||||
|
Mode: mode | DIR_FLAG,
|
||||||
|
})
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Cat) AppendBytes(content []byte, archPath string, mode cpio.FileMode) (r *Cat) {
|
func (c *Cat) AppendBytes(content []byte, archPath string, mode cpio.FileMode) (r *Cat) {
|
||||||
r = c
|
r = c
|
||||||
if c.err != nil {
|
if c.err != nil {
|
||||||
|
Reference in New Issue
Block a user