mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-02-19 09:40:59 +00:00
* 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:
parent
0f1ee27359
commit
4a17f0a7a0
4 changed files with 77 additions and 28 deletions
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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]]);
|
||||
|
|
18
ChangeLog
18
ChangeLog
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue