keywords: added experimental "xattr" keyword
Initially only on linux platform, but could accommodate BSDs as well. The keyword is rather a prefix of the key. So xattr keyword will have a prefix of "xattr." followed by a suffix of its namespace and name. The value stored in the manifest is the SHA1 digest of the extended attribute's data. Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
2d3aea8623
commit
211687bcc4
5 changed files with 34 additions and 2 deletions
5
walk.go
5
walk.go
|
@ -15,6 +15,8 @@ type ExcludeFunc func(path string, info os.FileInfo) bool
|
|||
// need a more linear walk, which this can not ensure.
|
||||
func Walk(root string, exlcudes []ExcludeFunc, keywords []string) (*DirectoryHierarchy, error) {
|
||||
dh := DirectoryHierarchy{}
|
||||
count := 0
|
||||
// TODO insert signature and metadata comments first
|
||||
err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -27,6 +29,7 @@ func Walk(root string, exlcudes []ExcludeFunc, keywords []string) (*DirectoryHie
|
|||
e := Entry{}
|
||||
//e.Name = filepath.Base(path)
|
||||
e.Name = path
|
||||
e.Pos = count
|
||||
for _, keyword := range keywords {
|
||||
if str, err := KeywordFuncs[keyword](path, info); err == nil && str != "" {
|
||||
e.Keywords = append(e.Keywords, str)
|
||||
|
@ -34,8 +37,8 @@ func Walk(root string, exlcudes []ExcludeFunc, keywords []string) (*DirectoryHie
|
|||
return err
|
||||
}
|
||||
}
|
||||
// XXX
|
||||
dh.Entries = append(dh.Entries, e)
|
||||
count++
|
||||
return nil
|
||||
})
|
||||
return &dh, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue