Re: Re: License file in Document Architecture
Re: Re: License file in Document Architecture
- Subject: Re: Re: License file in Document Architecture
- From: "Mark Munz" <email@hidden>
- Date: Thu, 26 Oct 2006 09:18:28 -0700
The trick is to add something like this method to your app delegate:
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString
*)filename
{
if ([[filename pathExtension] isEqualToString: LICENSE_EXTENSION])
{
[self installLicense:filename];
}
else
{
[[NSDocumentController sharedDocumentController]
openDocumentWithContentsOfFile:pathName display:YES];
}
return YES;
}
On 10/26/06, Kevin Hoctor <email@hidden> wrote:
On Oct 26, 2006, at 10:41 AM, I. Savant wrote:
> Is there some specific reason you need to open your license file
> as a document, using the Cocoa document architecture?
Yes, I want the user to be able to open the license file from the e-
mail or from the finder and have it associated with my application.
The only way I could figure out to handle this is to set the
CFBundleTypeExtensions in my Info.plist and handle this document with
another subclass. It works and it's not that much work, but if there
is a more "proper" way, I'd like to learn it.
I do store the license data in the preferences after this initial
action and load it from there. It's only the initial loading of the
license file that is handled via the document architecture.
Kevin Hoctor
No Thirst Software
http://nothirst.com
--
Mark Munz
unmarked software
http://www.unmarked.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden