makeDocumentWithContentsOfURL:ofType:error:
makeDocumentWithContentsOfURL:ofType:error:
- Subject: makeDocumentWithContentsOfURL:ofType:error:
- From: "Kirt Cathey" <email@hidden>
- Date: Sun, 15 May 2005 01:08:42 +0000
Hi All.
I have an if test that checks for existence of a file, then opens the file
if it exists, and opens
an untitled document if it doesn't exist. In order to make my app more user
friendly, I want the application to automatically create the file, apply
the file name, then open the file.
In order to do this, I have the following code:
NSString *openProjectString = [[NSString
alloc]initWithFormat:@"%@%@%@/%@.wp", NSHomeDirectory(), @"/WPData/",
[myProject name], [myProject name]];
NSFileManager *myFileManager = [NSFileManager defaultManager];
if ([myFileManager fileExistsAtPath:openProjectString])
{
[[NSDocumentController sharedDocumentController] setAutosavingDelay:300];
[[NSDocumentController sharedDocumentController]
openDocumentWithContentsOfFile:openProjectString display:YES];
} else {
[[NSDocumentController sharedDocumentController] setAutosavingDelay:300];
NSURL *thisURL = [NSURL fileURLWithPath:openProjectString];
[[NSDocumentController sharedDocumentController]
makeDocumentWithContentsOfURL:thisURL ofType:@"WorkPapers" error:nil];
}
However, makeDocumentWithContentsOfURL ... does not seem to work. Should
'ofType' refer to CFBundleTypeName in the plist? Or, should it refer to
something else?
Thanks again.
Regards,
Kirt
_________________________________________________________________
MSN Hotmailで開運メルアド占い実施中
http://promotion.msn.co.jp/hotmail/fortune/input_un.asp
_______________________________________________
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