Wed 19 Jun 2013 02:46:08 PM UTC, original submission:
There are a couple of aspects to this fix:
- on receiving -[EOMEDocument writeToURL:ofType:error:] the document would first try to copy its file URL to the destination, then it would try to write the EOModel to the destination (which would override the first activity). However, the -fileURL for a new, never before saved document is nil, so an exception was raised that caused saving to fail.
- new, untitled documents don't have a _eomodel, which means that saving wouldn't do anything anyway. This also introduces a lot of other bugs working with documents created with file->new, particularly related to setting the outline view selection.
This patch addresses both of these issues. It also removes a conditional check for -gui vs. AppKit, because the referenced bug in -gui has since been closed.
Index: Apps/EOModelEditor/EOMEDocument.m
===================================================================
--- Apps/EOModelEditor/EOMEDocument.m (revision 36732)
+++ Apps/EOModelEditor/EOMEDocument.m (working copy)
@@ -69,6 +69,15 @@
// [storedProceduresItem retain];
}
+- (id) init
+{
+ self = [super init];
+ if (self)
+ {
+ _eomodel = [EOModel new];
+ }
+ return self;
+}
- (void) dealloc
{
@@ -446,22 +455,8 @@
NSLog(@"%s:%@", _PRETTY_FUNCTION_, typeName);
NS_DURING {
-
-#ifdef GNUSTEP
-
-#warning "see http://savannah.gnu.org/bugs/index.php?30348"
-#else
- NSFileManager * manager = [NSFileManager defaultManager];
-
- [manager copyItemAtURL:[self fileURL]
- toURL:absoluteURL error:outError];
-
-#endif
-
- [_eomodel writeToFile: [absoluteURL path]];
-
+ [_eomodel writeToFile: [absoluteURL path]];
} NS_HANDLER {
-
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:[localException reason]
forKey:NSLocalizedDescriptionKey];
@@ -470,8 +465,6 @@
userInfo:userInfo];
return NO;
} NS_ENDHANDLER;
- // 'file://localhost/Users/dave/dev/PBXBilling/trunk/PBX.eomodeld/'
- // NSLog(@"fileURL '%@'", [self fileURL]);
return YES;
}
|