mirror of
https://github.com/transmission/transmission
synced 2025-03-12 07:03:44 +00:00
(hopefully) improve and streamline time machine code
This commit is contained in:
parent
87baf39a8e
commit
cf4566eccb
2 changed files with 5 additions and 16 deletions
|
@ -71,8 +71,6 @@ typedef enum
|
|||
int fOrderValue, fGroupValue;
|
||||
|
||||
NSDictionary * fQuickPauseDict;
|
||||
|
||||
BOOL fNeedSetTimeMachine;
|
||||
}
|
||||
|
||||
- (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (torrentFileState) torrentDelete
|
||||
|
|
|
@ -239,13 +239,6 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
{
|
||||
fStat = tr_torrentStat(fHandle);
|
||||
|
||||
//check if the file is created for Time Machine
|
||||
if (fNeedSetTimeMachine && [self isActive])
|
||||
{
|
||||
NSURL *url = [NSURL fileURLWithPath: [[self downloadFolder] stringByAppendingPathComponent: [self name]]];
|
||||
fNeedSetTimeMachine = CSBackupSetItemExcluded((CFURLRef)url, ![self allDownloaded], false) != noErr;
|
||||
}
|
||||
|
||||
//check to stop for ratio
|
||||
float stopRatio;
|
||||
if ([self isSeeding] && (stopRatio = [self actualStopRatio]) != INVALID && [self ratio] >= stopRatio)
|
||||
|
@ -1570,10 +1563,8 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
if ([NSApp isOnLeopardOrBetter])
|
||||
{
|
||||
NSURL *url = [NSURL fileURLWithPath: [[self downloadFolder] stringByAppendingPathComponent: [self name]]];
|
||||
fNeedSetTimeMachine = CSBackupSetItemExcluded((CFURLRef)url, ![self allDownloaded], false) != noErr;
|
||||
CSBackupSetItemExcluded((CFURLRef)url, ![self allDownloaded], true);
|
||||
}
|
||||
else
|
||||
fNeedSetTimeMachine = NO;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -1670,7 +1661,7 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
if ([NSApp isOnLeopardOrBetter])
|
||||
{
|
||||
NSURL *url = [NSURL fileURLWithPath: [[self downloadFolder] stringByAppendingPathComponent: [self name]]];
|
||||
fNeedSetTimeMachine = CSBackupSetItemExcluded((CFURLRef)url, false, false) != noErr;
|
||||
CSBackupSetItemExcluded((CFURLRef)url, false, true);
|
||||
}
|
||||
|
||||
NSString * folder = [self shouldUseIncompleteFolderForName: [self name]] ? fIncompleteFolder : fDownloadFolder;
|
||||
|
@ -1680,7 +1671,7 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
if ([NSApp isOnLeopardOrBetter])
|
||||
{
|
||||
NSURL *url = [NSURL fileURLWithPath: [folder stringByAppendingPathComponent: [self name]]];
|
||||
fNeedSetTimeMachine = CSBackupSetItemExcluded((CFURLRef)url, ![self allDownloaded], false) != noErr;
|
||||
CSBackupSetItemExcluded((CFURLRef)url, ![self allDownloaded], true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1727,7 +1718,7 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
if ([NSApp isOnLeopardOrBetter])
|
||||
{
|
||||
NSURL *url = [NSURL fileURLWithPath: [[self downloadFolder] stringByAppendingPathComponent: [self name]]];
|
||||
fNeedSetTimeMachine = CSBackupSetItemExcluded((CFURLRef)url, false, false) != noErr;
|
||||
CSBackupSetItemExcluded((CFURLRef)url, false, true);
|
||||
}
|
||||
|
||||
fStat = tr_torrentStat(fHandle);
|
||||
|
@ -1739,7 +1730,7 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
if ([NSApp isOnLeopardOrBetter])
|
||||
{
|
||||
NSURL *url = [NSURL fileURLWithPath: [[self downloadFolder] stringByAppendingPathComponent: [self name]]];
|
||||
fNeedSetTimeMachine = CSBackupSetItemExcluded((CFURLRef)url, true, false) != noErr;
|
||||
CSBackupSetItemExcluded((CFURLRef)url, true, true);
|
||||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentRestartedDownloading" object: self];
|
||||
|
|
Loading…
Add table
Reference in a new issue