* EOAccess/EOModel.m

-writeToFile:
Don't copy or move directories
create an dir only if we have none
* Apps/EOModelEditor/EOMEDocument.m
copy old wrapper dir to new tmp path/URL
The model overwrites our own files then.
Trash like .svn stays intact this way :-)
Only OSX at the moment.
see
http://savannah.gnu.org/bugs/index.php?30348
(#ifdef'd)
-keepBackupFile
return YES
* Apps/EOModelEditor/CodeGenerator.m
don't write code for EOGenericRecord or EOCustomObject



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@30922 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Dave Wetzel 2010-07-05 01:58:11 +00:00
parent 0f1ee27359
commit 4a17f0a7a0
4 changed files with 77 additions and 28 deletions

View file

@ -720,10 +720,15 @@ void addToUsedClasses(NSMutableArray * mutArray,NSSet * knownNames, NSArray * ot
entityEnumer = [[_model entities] objectEnumerator];
while ((currentEntity = [entityEnumer nextObject])) {
[self generateSuperInterfaceFileForEntity:currentEntity];
[self generateSuperclassFileForEntity:currentEntity];
[self generateSubInterfaceFileForEntity:currentEntity];
[self generateSubclassFileForEntity:currentEntity];
NSString * className = [currentEntity className];
if ((![className isEqual:@"EOGenericRecord"]) &&
(![className isEqual:@"EOCustomObject"])) {
[self generateSuperInterfaceFileForEntity:currentEntity];
[self generateSuperclassFileForEntity:currentEntity];
[self generateSubInterfaceFileForEntity:currentEntity];
[self generateSubclassFileForEntity:currentEntity];
}
}
}
}

View file

@ -446,6 +446,17 @@ NSString *EOMConsistencyModelObjectKey = @"EOMConsistencyModelObjectKey";
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]];
@ -459,7 +470,8 @@ NSString *EOMConsistencyModelObjectKey = @"EOMConsistencyModelObjectKey";
userInfo:userInfo];
return NO;
} NS_ENDHANDLER;
// 'file://localhost/Users/dave/dev/PBXBilling/trunk/PBX.eomodeld/'
// NSLog(@"fileURL '%@'", [self fileURL]);
return YES;
}
@ -495,6 +507,11 @@ NSString *EOMConsistencyModelObjectKey = @"EOMConsistencyModelObjectKey";
//}
- (BOOL)keepBackupFile
{
return YES;
}
- (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError
{
ASSIGN(_eomodel, [EOModel modelWithContentsOfFile: [absoluteURL path]]);

View file

@ -1,3 +1,21 @@
2010-07-04 David Wetzel <dave@turbocat.de>
* EOAccess/EOModel.m
-writeToFile:
Don't copy or move directories
create an dir only if we have none
* Apps/EOModelEditor/EOMEDocument.m
copy old wrapper dir to new tmp path/URL
The model overwrites our own files then.
Trash like .svn stays intact this way :-)
Only OSX at the moment.
see
http://savannah.gnu.org/bugs/index.php?30348
(#ifdef'd)
-keepBackupFile
return YES
* Apps/EOModelEditor/CodeGenerator.m
don't write code for EOGenericRecord or EOCustomObject
2010-07-04 David Wetzel <dave@turbocat.de>
* EOAccess/EODatabaseContext.m
use memset in place of bzero

View file

@ -612,48 +612,57 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
writeSingleFile = [extension isEqualToString: @"eomodel"] ? YES : NO;
/*
* Don't copy directories. EOModelEditor and NSDocument do all the magic for us.
*/
/*
if ([mgr fileExistsAtPath: path])
{
NSString *backupPath;
backupPath = [path stringByAppendingString: @"~"];
if ([mgr fileExistsAtPath: backupPath])
{
NSString *backupPath;
backupPath = [path stringByAppendingString: @"~"];
if ([mgr fileExistsAtPath: backupPath])
{
if ([mgr removeFileAtPath: backupPath handler: nil] == NO)
if ([mgr removeFileAtPath: backupPath handler: nil] == NO)
{
NSString *fmt;
fmt = [NSString stringWithFormat: @"Could not remove %@",
backupPath];
backupPath];
[NSException raise: NSInvalidArgumentException
format: fmt];
format: fmt];
}
}
if ([mgr movePath: path toPath: backupPath handler: nil] == NO)
{
NSString *fmt;
fmt = [NSString stringWithFormat: @"Could not move %@ to %@",
path, backupPath];
[NSException raise: NSInvalidArgumentException
format: fmt];
}
}
if ([mgr movePath: path toPath: backupPath handler: nil] == NO)
{
NSString *fmt;
fmt = [NSString stringWithFormat: @"Could not move %@ to %@",
path, backupPath];
[NSException raise: NSInvalidArgumentException
format: fmt];
}
}
*/
[self _setPath: path];
pList = [NSMutableDictionary dictionaryWithCapacity: 10];
[self encodeIntoPropertyList: pList];
if (writeSingleFile == NO
&& [mgr createDirectoryAtPath: path attributes: nil] == NO)
// create an dir only if we have none.
if (![mgr fileExistsAtPath: path])
{
if (writeSingleFile == NO
&& [mgr createDirectoryAtPath: path attributes: nil] == NO)
{
NSString *fmt;
fmt = [NSString stringWithFormat: @"Could not create directory: %@",
path];
path];
[NSException raise: NSInvalidArgumentException
format: fmt];
format: fmt];
}
}
entityEnum = [[pList objectForKey: @"entities"] objectEnumerator];
while (writeSingleFile == NO