diff --git a/src/duplicacy_utils_others.go b/src/duplicacy_utils_others.go index 1465fee..1ed1462 100644 --- a/src/duplicacy_utils_others.go +++ b/src/duplicacy_utils_others.go @@ -13,7 +13,7 @@ import ( "path/filepath" "syscall" - "github.com/gilbertchen/xattr" + "github.com/pkg/xattr" ) func Readlink(path string) (isRegular bool, s string, err error) { @@ -50,11 +50,11 @@ func SetOwner(fullPath string, entry *Entry, fileInfo *os.FileInfo) bool { func (entry *Entry) ReadAttributes(top string) { fullPath := filepath.Join(top, entry.Path) - attributes, _ := xattr.Listxattr(fullPath) + attributes, _ := xattr.List(fullPath) if len(attributes) > 0 { entry.Attributes = make(map[string][]byte) for _, name := range attributes { - attribute, err := xattr.Getxattr(fullPath, name) + attribute, err := xattr.Get(fullPath, name) if err == nil { entry.Attributes[name] = attribute } @@ -63,24 +63,25 @@ func (entry *Entry) ReadAttributes(top string) { } func (entry *Entry) SetAttributesToFile(fullPath string) { - names, _ := xattr.Listxattr(fullPath) + names, _ := xattr.List(fullPath) for _, name := range names { + newAttribute, found := entry.Attributes[name] if found { - oldAttribute, _ := xattr.Getxattr(fullPath, name) + oldAttribute, _ := xattr.Get(fullPath, name) if !bytes.Equal(oldAttribute, newAttribute) { - xattr.Setxattr(fullPath, name, newAttribute) + xattr.Set(fullPath, name, newAttribute) } delete(entry.Attributes, name) } else { - xattr.Removexattr(fullPath, name) + xattr.Remove(fullPath, name) } } for name, attribute := range entry.Attributes { - xattr.Setxattr(fullPath, name, attribute) + xattr.Set(fullPath, name, attribute) } }