mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-11-29 03:25:39 +00:00
37 lines
947 B
Go
37 lines
947 B
Go
// +build !linux,!darwin,!freebsd,!netbsd,!openbsd
|
|
|
|
package mtree
|
|
|
|
import (
|
|
"archive/tar"
|
|
"fmt"
|
|
"io"
|
|
"os"
|
|
)
|
|
|
|
var (
|
|
unameKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
|
if hdr, ok := info.Sys().(*tar.Header); ok {
|
|
return fmt.Sprintf("uname=%s", hdr.Uname), nil
|
|
}
|
|
return "", nil
|
|
}
|
|
uidKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
|
if hdr, ok := info.Sys().(*tar.Header); ok {
|
|
return fmt.Sprintf("uid=%d", hdr.Uid), nil
|
|
}
|
|
return "", nil
|
|
}
|
|
gidKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
|
if hdr, ok := info.Sys().(*tar.Header); ok {
|
|
return fmt.Sprintf("gid=%d", hdr.Gid), nil
|
|
}
|
|
return "", nil
|
|
}
|
|
nlinkKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
|
return "", nil
|
|
}
|
|
xattrKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
|
return "", nil
|
|
}
|
|
)
|