* EOAccess/EOModel.m

add - _deleteTrashAtPath:
avoid keeping unused files in the wrapper directory.
basically, .svn/.cvs/.git
as this does not change that often I am not moving this to an 
external plist at the moment.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@30929 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Dave Wetzel 2010-07-05 19:56:10 +00:00
parent f193f8ba1e
commit 1dc20fe252
2 changed files with 40 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2010-07-05 David Wetzel <dave@turbocat.de>
* EOAccess/EOModel.m
add - _deleteTrashAtPath:
avoid keeping unused files in the wrapper directory.
basically, .svn/.cvs/.git
as this does not change that often I am not moving this to an
external plist at the moment.
2010-07-05 David Wetzel <dave@turbocat.de>
* EOAccess/EODatabaseContext.m
valuesForKeys: -> dictionaryWithValuesForKeys:

View file

@ -569,6 +569,36 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
return ok;
}
/**
* Deletes any non-known files/paths at path.
* private.
*/
- (void) _deleteTrashAtPath:(NSString*) path
{
NSFileManager * manager = [NSFileManager defaultManager];
NSDirectoryEnumerator * dirEnumer = [manager enumeratorAtPath:path];
NSArray * knownTrashPaths = [NSArray arrayWithObjects:@".svn",
@".cvs", @".git",
nil];
NSString * fileName = nil;
while ((fileName = [dirEnumer nextObject])) {
NSString * prefix = [[fileName pathComponents] objectAtIndex:0];
if (([knownTrashPaths containsObject:prefix] == NO)) {
NSString * fullPath = nil;
fullPath = [path stringByAppendingPathComponent:fileName];
if ([manager removeFileAtPath: fullPath handler: nil] == NO)
{
[NSException raise: NSInvalidArgumentException
format: @"Could not remove %@", fullPath];
}
}
}
}
/**
* <p>Writes the receivers plist representation into an
* .eomodeld file wrapper located at path. </p>
@ -664,6 +694,8 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
}
}
[self _deleteTrashAtPath:path];
entityEnum = [[pList objectForKey: @"entities"] objectEnumerator];
while (writeSingleFile == NO
&& (entityPList = [entityEnum nextObject]))