Re: Associating a library created file with my application
Re: Associating a library created file with my application
- Subject: Re: Associating a library created file with my application
- From: Fritz Anderson <email@hidden>
- Date: Thu, 15 Apr 2004 11:02:57 -0500
You will have to associate a file extension (or as another poster
suggested, an OSType) with your application. This is done by adding a
CFBundleDocumentTypes key to the info.plist file for the application.
The value for that key is an array of dictionaries, one for each
document type. A document type dictionary must contain
CFBundleTypeExtensions, an array of extensions used for that type
CFBundleTypeName, a human-readable name (or key to a localized name)
for the type, and
CFBundleTypeRole, which is Editor, Viewer, or None, depending on
whether your application writes, reads, or is merely associated with,
the file type.
If you go the type/creator route, include CFBundleTypeOSTypes, an array
of the associated OSTypes.
See
<
http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/
Concepts/DocTypePList.html>; the first example is from TextEdit, which,
like your application, is not NSDocument-based.
You can get the proper effect by selecting your application target in
Xcode, opening the info inspector, selecting the Properties tab, and
filling in the information for a document type, omitting the document
class. I'd double-check the generated info.plist file to make sure the
NSDocumentClass key doesn't get inserted.
You'll also want to look into implementing application:openFile: in
your application delegate class.
-- F
On 14 Apr 2004, at 10:30 PM, Steve Palmer wrote:
I may have missed something extremely obvious but... is there a way to
associate a file that is created by a third-party library that I use
with my own application? Specifically, after I call the library to
create the file (which uses the C-run time library functions), I want
to set the file so that opening from Finder will open my application
and it will have an icon that I specify? My application is not
NSDocument based if that is significant.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.