Replacing default FileSystemProvider

Alan Bateman Alan.Bateman at oracle.com
Sun Mar 21 08:14:29 UTC 2021


On 20/03/2021 23:30, Michael Hall wrote:
> :
> The idea wasn’t to completely replace the default ‘file’ provider but to expose some native API’s through nio attributes. The main use I am remembering. For other purposes it served as a passthrough to the usual default.
>
> So for the FileManager replacement that was being discussed earlier there could be…
>
>          Files.setAttribute(p, "mac_finder:type", new String(b));
>          pokeInt(b,0,creator);
>          Files.setAttribute(p, "mac_finder:creator", new String(b));
>
> mac_finder would be the API concerned followed by the attribute.
> I had attributes for 3 or 4 native API’s.
Maybe I have this wrong but I thought that the type/creator codes have 
been obsolete for more than 10 years. That is, I think macOS ignores 
them but maybe are working with programs that still use them?

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).

-Alan.


More information about the nio-dev mailing list