: Proper way to create a proprietary file extension?


cap10subtext
Jun 15th, 2011, 12:05 AM
Been tooling away at this for what seems like forever.

Let's say I have a text file I want to use as a .zzz extension project file. If I click on that project it should open only in my application and it should adopt my projectile.icns icon on the end users machine.

2 questions:

1. What's the "correct way to do this?" (cocoa, objective c, carbon, don't really care, just want to know the apple guidelines which I cannot find detailed instructions for).

2. Being that I'm using a non standard programing language (the still bundle .rsrc with the app if you can believe it), is there any alternative way I can affect a file/resource fork/app plist so that every .zzz file adopts my little custom icon on the end users computer?

All advice welcome.

Chealion
Jun 15th, 2011, 03:04 PM
1 and 2 kind of go hand in hand - in that it's a matter of telling Mac OS X (LaunchServices specifically) that you open .zzz files and to take "ownership" of those files. (CFBundleDocumentTypes and UTIs - document codes and creator codes are ignored in 10.6+).

Check out:
objective c - Registering an icon for my application's document type. - Stack Overflow (http://stackoverflow.com/questions/1771601/registering-an-icon-for-my-applications-document-type)
Developer.apple.com : Understanding UTIs (http://developer.apple.com/library/mac/#documentation/FileManagement/Conceptual/understanding_utis/understand_utis_declare/understand_utis_declare.html)
Developer.apple.com : LaunchServices Concepts (http://developer.apple.com/library/mac/#documentation/Carbon/Conceptual/LaunchServicesConcepts/LSCIntro/LSCIntro.html#//apple_ref/doc/uid/TP30000999)
Developer.apple.com : LaunchServices Reference (http://developer.apple.com/library/mac/#documentation/Carbon/Reference/LaunchServicesReference/Reference/reference.html#//apple_ref/doc/uid/TP30000998)

cap10subtext
Jun 16th, 2011, 11:48 PM
I just stumbled across those official Apple docs myself. Guess it just took a while to start googling the correct terms.

That StackO post is likely the little extra bit of I needed. Unfortunately not sitting with the plist infront of me to double check.

I had a weird surprise when after a day of trying to assign the custom icons including a number of restarts, suddenly it started looking like it was working. But now I have to go back and verify which the crucial bit of info was.

Thanks so much!