From 085302f15fc7946d765709c434724f017395ca11 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sat, 31 Oct 2009 16:25:00 +0000 Subject: [PATCH] simplify the time machine updating method --- macosx/Torrent.m | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 58eef79ef..85a5eece5 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -1395,40 +1395,26 @@ int trashDataFile(const char * filename) - (void) updateTimeMachineExclude { - NSString * newLocation = nil; - BOOL checkedNewLocation = NO; + NSString * currentLocation = ![self allDownloaded] ? [self dataLocation] : nil; + //return if the locations are the same + if (fTimeMachineExclude && currentLocation && [fTimeMachineExclude isEqualToString: currentLocation]) + return; + + //remove old location... 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]; [fTimeMachineExclude release]; fTimeMachineExclude = nil; } - if (![self allDownloaded]) + //...set new location + if (currentLocation) { - if (!checkedNewLocation) - { - newLocation = [self dataLocation]; - checkedNewLocation = YES; - } - - if (newLocation) - { - [self setTimeMachineExclude: YES forPath: newLocation]; - [fTimeMachineExclude release]; - fTimeMachineExclude = [newLocation retain]; - } + [self setTimeMachineExclude: YES forPath: currentLocation]; + [fTimeMachineExclude release]; + fTimeMachineExclude = [currentLocation retain]; } }