Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Markowski committed Feb 7, 2010
1 parent 580c6d4 commit f71d6cc
Show file tree
Hide file tree
Showing 17 changed files with 2,425 additions and 1,108 deletions.
78 changes: 78 additions & 0 deletions AFGameEditor.m
Expand Up @@ -113,6 +113,31 @@ - (BOOL)configurePersistentStoreCoordinatorForURL:(NSURL *)url
}
*/

- (BOOL)configurePersistentStoreCoordinatorForURL:(NSURL*)url
ofType:(NSString*)fileType
modelConfiguration:(NSString*)configuration
storeOptions:(NSDictionary*)storeOptions
error:(NSError**)error
{
NSMutableDictionary *options = nil;
if (storeOptions != nil) {
options = [storeOptions mutableCopy];
} else {
options = [[NSMutableDictionary alloc] init];
}

[options setObject:[NSNumber numberWithBool:YES]
forKey:NSMigratePersistentStoresAutomaticallyOption];

BOOL result = [super configurePersistentStoreCoordinatorForURL:url
ofType:fileType
modelConfiguration:configuration
storeOptions:options
error:error];
[options release], options = nil;
return result;
}

- (void)awakeFromNib {
[drawer openOnEdge:NSMinXEdge];
self.volatileTextureToAtlasNameMap = [NSMutableDictionary dictionary];
Expand Down Expand Up @@ -299,5 +324,58 @@ - (int)renumberViewPositionsOfItems:(NSArray *)array startingAt:(int)value
return currentViewPosition;
}

- (NSError *)willPresentError:(NSError *)inError {

// The error is a Core Data validation error if its domain is
// NSCocoaErrorDomain and it is between the minimum and maximum
// for Core Data validation error codes.

if (!([[inError domain] isEqualToString:NSCocoaErrorDomain])) {
return inError;
}

NSInteger errorCode = [inError code];
if ((errorCode < NSValidationErrorMinimum) ||
(errorCode > NSValidationErrorMaximum)) {
return inError;
}

// If there are multiple validation errors, inError is an
// NSValidationMultipleErrorsError. If it's not, return it

if (errorCode != NSValidationMultipleErrorsError) {
return inError;
}

// For an NSValidationMultipleErrorsError, the original errors
// are in an array in the userInfo dictionary for key NSDetailedErrorsKey
NSArray *detailedErrors = [[inError userInfo] objectForKey:NSDetailedErrorsKey];

// For this example, only present error messages for up to 3 validation errors at a time.

unsigned numErrors = [detailedErrors count];
NSMutableString *errorString = [NSMutableString stringWithFormat:@"%u validation errors have occurred", numErrors];

if (numErrors > 3) {
[errorString appendFormat:@".\nThe first 3 are:\n"];
}
else {
[errorString appendFormat:@":\n"];
}
NSUInteger i, displayErrors = numErrors > 3 ? 3 : numErrors;
for (i = 0; i < displayErrors; i++) {
[errorString appendFormat:@"%@\n",
[[detailedErrors objectAtIndex:i] localizedDescription]];
}

// Create a new error with the new userInfo
NSMutableDictionary *newUserInfo = [NSMutableDictionary
dictionaryWithDictionary:[inError userInfo]];
[newUserInfo setObject:errorString forKey:NSLocalizedDescriptionKey];

NSError *newError = [NSError errorWithDomain:[inError domain] code:[inError code] userInfo:newUserInfo];

return newError;
}

@end
771 changes: 751 additions & 20 deletions English.lproj/GameEditor.xib

Large diffs are not rendered by default.

Binary file removed Game.xcdatamodel/elements
Binary file not shown.
8 changes: 8 additions & 0 deletions Game.xcdatamodeld/.xccurrentversion
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>_XCCurrentVersionName</key>
<string>Game0.2.xcdatamodel</string>
</dict>
</plist>
410 changes: 410 additions & 0 deletions Game.xcdatamodeld/Game0.1-0.2.xcmappingmodel/xcmapping.xml

Large diffs are not rendered by default.

Binary file added Game.xcdatamodeld/Game0.1.xcdatamodel/elements
Binary file not shown.
Binary file not shown.
Binary file added Game.xcdatamodeld/Game0.2.xcdatamodel/elements
Binary file not shown.
Binary file added Game.xcdatamodeld/Game0.2.xcdatamodel/layout
Binary file not shown.

0 comments on commit f71d6cc

Please sign in to comment.