I am working with files whose content format has changed over multiple versions of OSX, previously it was ASCII, then JSON, now a binary plist. So I need to determine what kind of file it is so I can parse it either as text, using the JSON APIs, or loading the plist as dictionary/array.
I can use the /usr/bin/file command to tell me the file content type, but I'd prefer to do this programmatically. Is there a Cocoa API for this?
I've looked at NSFileManager attributesOfItemAtPath:error: but that just returns NSFileTypeRegular, which doesn't help.