Ensure proper working of autosaving for NSDocument subclasses that

override -writeWithBackupToFile:ofType:saveOperation.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29267 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
wlux 2010-01-11 21:26:12 +00:00
parent 31586c0e6f
commit 5736f119e9
2 changed files with 21 additions and 4 deletions

View file

@ -868,15 +868,28 @@ withContentsOfURL: (NSURL *)url
if (OVERRIDDEN(writeWithBackupToFile:ofType:saveOperation:))
{
BOOL isAutosave = NO;
if (op == NSAutosaveOperation)
{
op = NSSaveToOperation;
isAutosave = YES;
}
*error = nil;
return [self writeWithBackupToFile: [url path]
ofType: type
saveOperation: op];
if (![self writeWithBackupToFile: [url path]
ofType: type
saveOperation: op])
{
return NO;
}
if (isAutosave)
{
[self setAutosavedContentsFileURL: url];
[self updateChangeCount: NSChangeAutosaved];
}
return YES;
}
if (!isNativeType || (url == nil))