Package list golang-github-vbatts-go-mtree / b37d6dc7-7334-4ece-84e6-4b44d0746757/main updatefuncs_linux.go
b37d6dc7-7334-4ece-84e6-4b44d0746757/main

Tree @b37d6dc7-7334-4ece-84e6-4b44d0746757/main (Download .tar.gz)

updatefuncs_linux.go @b37d6dc7-7334-4ece-84e6-4b44d0746757/mainraw · history · blame

// +build linux

package mtree

import (
	"encoding/base64"
	"os"

	"github.com/vbatts/go-mtree/xattr"
)

func xattrUpdateKeywordFunc(path string, kv KeyVal) (os.FileInfo, error) {
	buf, err := base64.StdEncoding.DecodeString(kv.Value())
	if err != nil {
		return nil, err
	}
	if err := xattr.Set(path, kv.Keyword().Suffix(), buf); err != nil {
		return nil, err
	}
	return os.Lstat(path)
}