Core Data & prepareSavePanel
Core Data & prepareSavePanel
- Subject: Core Data & prepareSavePanel
- From: Todd Freese <email@hidden>
- Date: Sat, 4 Mar 2006 20:54:41 -0600
In my core data doc-style app, I need to set the default filename for
the save panel. I am using an XML type store. When I override
prepareSavePanel the save panel works, but I get a "nil is not a
valid persistent store" error. How do I set the store to XML? I have
it set in my info.plist.
Here is my code:
- (BOOL)prepareSavePanel:(NSSavePanel*)savePanel
{
// Build default save to directory path. Start with program
preference for the project root path.
NSMutableString *path = [NSMutableString stringWithString:
[[NSUserDefaults standardUserDefaults]
stringForKey:SS_ProjectRootPathKey]];
[path appendString:@"/"];
// Append colorist name to path.
[path appendString:[[[AppController sharedInstance]
loggedInColorist] objectForKey:@"coloristName"]];
[path appendString:@"/"];
[savePanel setDirectory:path];
// Build default file name.
if ([self fileName] == nil) {
NSMutableString *fileName = [NSMutableString stringWithString:@""];
if ([[[self job] jobNumber] isNotEqualTo:@""]) {
[fileName appendString:[[self job] jobNumber]];
}
[self setFileName:fileName];
}
return YES;
}
Todd Freese
The Filmworkers Club
_______________________________________________
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