Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing NSDocument's default saving behavior



On Feb 26, 2006, at 11:40 AM, Stephen F. Booth wrote:

Which methods would I need to override to achieve this? I have tried everything I can think of; I am able to modify the original file in place (simply by using [self fileURL] as the path, but the save operations are reported as failing to the user, since the temporary file is not being created.



- (BOOL)saveToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation error:(NSError **) outError
{
BOOL result = [self writeToURL:absoluteURL ofType:typeName forSaveOperation:saveOperation originalContentsURL:absoluteURL error:outError];

if (result && (saveOperation == NSSaveAsOperation || saveOperation == NSSaveOperation)) {
[self setFileName:[absoluteURL relativePath]];
[self updateChangeCount:NSChangeCleared];
}

return result;
}



Try that.


-- Seth Willits

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Changing NSDocument's default saving behavior (From: "Stephen F. Booth" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.