Replacing default FileSystemProvider

Michael Hall mik3hall at gmail.com
Sun Mar 21 23:09:16 UTC 2021


> 
> I did a quick test with SetFile/GetFile (these programs are deprecated but are still included with Xcode) and I see that they are storing the codes in an extended attribute named "com.apple.FinderInfo". If you know the format then it means they you should be able to use the UserFileAttributeView to access them (Sebastian Stenzel did great work to implement this attribute view on macOS recently).


Had to review what I had. Actually, mac_xattr is one of the API”s I supported nio attributes for…

Map<String,Object> attrs = Files.readAttributes(p,"mac_xattr:*");
			assertEquals(2,attrs.size());
			assertTrue(attrs.containsKey("mac_xattr:com.apple.FinderInfo"));
			byte[] finfo = (byte[])attrs.get("mac_xattr:com.apple.FinderInfo");
			assertEquals(32,finfo.length);

There was some redundancy across API’s.

There is also the LaunchServices API

if (!((Boolean)Files.getAttribute(p,"mac_ls:application")).booleanValue()) {

One use is information about the default application associated with a file.

And mac_cocoa for the NS API family

assertFalse(((Boolean)Files.getAttribute(p,"mac_cocoa:NSFileBusy")).booleanValue());
			assertEquals(Files.size(p),((Long)Files.getAttribute(p,"mac_cocoa:NSFileSize")).longValue());
			attrs = Files.readAttributes(p,"mac_cocoa:NSFileModificationDate,mac_cocoa:NSFilePosixPermissions”);

I’m not sure this API driven stuff would exactly translate to a user attribute view.


More information about the nio-dev mailing list