Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File type misery - Cocoa

So we recently shipped a document based application with an unfortunate oversight: the UTI for our main document type was left blank. We had a name for it, but the identifier was straight up empty.

Everything still worked great, but then we went to add another file type to the mix. The new file type is simply xml (conforms to public.xml). We set that up and dropped it into the document. This is when we caught our oversight on the first document type's UTI.

Now, if we so much as touch this document type, BOOM. The application can't read any files it has created of that type. We really want to clean this up, so what's the best way to do so?

My question is essentially: How do you migrate your main document type in a document based application?

like image 696
DexterW Avatar asked Nov 13 '22 12:11

DexterW


1 Answers

First, it's very difficult to debug this type of problem on the machine you're using to cut builds. The dynamic UTI system gets confused as to which app owns which files. To solve this issue, there is a command you can run in terminal to clear out the file associations on your system.

Next, we tackled the actual document types of our application. Ultimately, we want to support just two document types, our custom type and the xml type. However, we had to keep that empty, dynamically generated UTI that was shipped. In "Document types", we have three: the two we actually want to support and the legacy one we no longer want. For the first two, our application is an "Editor". For the legacy one, we changed it to "Reader".

Another thing that really helped our system out is using exported an imported UTIs. We told the system our application imports the XML type, and exports the two others.

We've done some pretty significant testing, including deployment, and this configuration works like a charm.

like image 183
DexterW Avatar answered Dec 18 '22 14:12

DexterW