I am developing a File Provider Extension on Mac. I am confused about how the extendedAttributes property works. The property never seems to be populated with any extended attributes.
I've tried setting some custom extended attributes on my documents in testing, but they are never populated in the itemTemplates that are produced in the extension. The dictionary that would hold the extended attributes always is empty.
I began to think that it only supported Mac-created attributes such as com.apple.quarantine.
I then tried importing some files that are 'quarantined' with this appropriate extended attribute but still have not seen this data appear in my extension either.
Any clarity here with what I should be expecting or what I should try would be helpful.
FileProvider syncs extended attributes with the XATTR_FLAG_SYNCABLE
property set.
See xattr_flags.h
: https://opensource.apple.com/source/copyfile/copyfile-146/xattr_flags.h.auto.html
Specifically, xattr_name_with_flags
for how to construct extended attribute names with the XATTR_FLAG_SYNCABLE
property.
In practice it is appending #S
to the name of the extended attribute. In your application, you should always use the method in xattr_flags.h
to manipulate extended attribute names.
You can use xattr_preserve_for_intent
or xattr_flags_from_name
to determine whether the system would sync a given extended attribute.