update the time machine exclude list when the file is moved through rpc
This commit is contained in:
parent
7f5cfbec77
commit
793524ac47
|
@ -265,5 +265,6 @@ typedef enum
|
|||
- (void) rpcRemoveTorrent: (Torrent *) torrent;
|
||||
- (void) rpcStartedStoppedTorrent: (Torrent *) torrent;
|
||||
- (void) rpcChangedTorrent: (Torrent *) torrent;
|
||||
- (void) rpcMovedTorrent: (Torrent *) torrent;
|
||||
|
||||
@end
|
||||
|
|
|
@ -4249,6 +4249,10 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
[self performSelectorOnMainThread: @selector(rpcChangedTorrent:) withObject: torrent waitUntilDone: NO];
|
||||
break;
|
||||
|
||||
case TR_RPC_TORRENT_MOVED:
|
||||
[self performSelectorOnMainThread: @selector(rpcMovedTorrent:) withObject: torrent waitUntilDone: NO];
|
||||
break;
|
||||
|
||||
case TR_RPC_SESSION_CHANGED:
|
||||
[fPrefsController performSelectorOnMainThread: @selector(rpcUpdatePrefs) withObject: nil waitUntilDone: NO];
|
||||
break;
|
||||
|
@ -4308,4 +4312,15 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
[torrent release];
|
||||
}
|
||||
|
||||
- (void) rpcMovedTorrent: (Torrent *) torrent
|
||||
{
|
||||
[torrent update];
|
||||
[torrent updateTimeMachineExclude];
|
||||
|
||||
if ([[fTableView selectedTorrents] containsObject: torrent])
|
||||
[fInfoController updateInfoStats];
|
||||
|
||||
[torrent release];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -222,6 +222,8 @@
|
|||
- (NSInteger) stalledMinutes;
|
||||
- (BOOL) isStalled;
|
||||
|
||||
- (void) updateTimeMachineExclude;
|
||||
|
||||
- (NSInteger) stateSortKey;
|
||||
- (NSString *) trackerSortKey;
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
|
||||
- (NSString *) etaString;
|
||||
|
||||
- (void) updateTimeMachineExclude;
|
||||
- (void) setTimeMachineExclude: (BOOL) exclude forPath: (NSString *) path;
|
||||
|
||||
@end
|
||||
|
@ -1457,6 +1456,28 @@ int trashDataFile(const char * filename)
|
|||
return fStalled;
|
||||
}
|
||||
|
||||
- (void) updateTimeMachineExclude
|
||||
{
|
||||
NSString * newLocation = [self dataLocation];
|
||||
|
||||
if (fTimeMachineExclude && newLocation && [fTimeMachineExclude isEqualToString: newLocation] && ![self allDownloaded])
|
||||
return;
|
||||
|
||||
if (fTimeMachineExclude)
|
||||
{
|
||||
[self setTimeMachineExclude: NO forPath: fTimeMachineExclude];
|
||||
[fTimeMachineExclude release];
|
||||
fTimeMachineExclude = nil;
|
||||
}
|
||||
|
||||
if (newLocation && ![self allDownloaded])
|
||||
{
|
||||
[self setTimeMachineExclude: YES forPath: newLocation];
|
||||
[fTimeMachineExclude release];
|
||||
fTimeMachineExclude = [newLocation retain];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSInteger) stateSortKey
|
||||
{
|
||||
if (![self isActive]) //paused
|
||||
|
@ -1734,28 +1755,6 @@ int trashDataFile(const char * filename)
|
|||
}
|
||||
}
|
||||
|
||||
- (void) updateTimeMachineExclude
|
||||
{
|
||||
NSString * newLocation = [self dataLocation];
|
||||
|
||||
if (fTimeMachineExclude && newLocation && [fTimeMachineExclude isEqualToString: newLocation] && ![self allDownloaded])
|
||||
return;
|
||||
|
||||
if (fTimeMachineExclude)
|
||||
{
|
||||
[self setTimeMachineExclude: NO forPath: fTimeMachineExclude];
|
||||
[fTimeMachineExclude release];
|
||||
fTimeMachineExclude = nil;
|
||||
}
|
||||
|
||||
if (newLocation && ![self allDownloaded])
|
||||
{
|
||||
[self setTimeMachineExclude: YES forPath: newLocation];
|
||||
[fTimeMachineExclude release];
|
||||
fTimeMachineExclude = [newLocation retain];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setTimeMachineExclude: (BOOL) exclude forPath: (NSString *) path
|
||||
{
|
||||
CSBackupSetItemExcluded((CFURLRef)[NSURL fileURLWithPath: path], exclude, true);
|
||||
|
|
Loading…
Reference in New Issue