simplify the time machine updating method

This commit is contained in:
Mitchell Livingston 2009-10-31 16:25:00 +00:00
parent 821b215f37
commit 085302f15f
1 changed files with 11 additions and 25 deletions

View File

@ -1395,40 +1395,26 @@ int trashDataFile(const char * filename)
- (void) updateTimeMachineExclude - (void) updateTimeMachineExclude
{ {
NSString * newLocation = nil; NSString * currentLocation = ![self allDownloaded] ? [self dataLocation] : nil;
BOOL checkedNewLocation = NO;
//return if the locations are the same
if (fTimeMachineExclude && currentLocation && [fTimeMachineExclude isEqualToString: currentLocation])
return;
//remove old location...
if (fTimeMachineExclude) if (fTimeMachineExclude)
{ {
//long-winded way of saying "return if the locations are the same and not all is downloaded"
if (![self allDownloaded])
{
newLocation = [self dataLocation];
checkedNewLocation = YES;
if (newLocation && [fTimeMachineExclude isEqualToString: newLocation])
return;
}
[self setTimeMachineExclude: NO forPath: fTimeMachineExclude]; [self setTimeMachineExclude: NO forPath: fTimeMachineExclude];
[fTimeMachineExclude release]; [fTimeMachineExclude release];
fTimeMachineExclude = nil; fTimeMachineExclude = nil;
} }
if (![self allDownloaded]) //...set new location
if (currentLocation)
{ {
if (!checkedNewLocation) [self setTimeMachineExclude: YES forPath: currentLocation];
{ [fTimeMachineExclude release];
newLocation = [self dataLocation]; fTimeMachineExclude = [currentLocation retain];
checkedNewLocation = YES;
}
if (newLocation)
{
[self setTimeMachineExclude: YES forPath: newLocation];
[fTimeMachineExclude release];
fTimeMachineExclude = [newLocation retain];
}
} }
} }