(Mac client) #1029: When removing local data only remove data from the torrent

This commit is contained in:
Mitchell Livingston 2008-12-24 01:55:33 +00:00
parent 2d6b6e6306
commit 4df8705d82
1 changed files with 11 additions and 5 deletions

View File

@ -55,7 +55,7 @@
- (void) updateAllTrackers: (NSMutableArray *) trackers;
- (void) trashFile: (NSString *) path;
+ (void) trashFile: (NSString *) path;
- (void) setTimeMachineExclude: (BOOL) exclude forPath: (NSString *) path;
@ -67,6 +67,12 @@ void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, vo
withObject: [[NSNumber alloc] initWithInt: status] waitUntilDone: NO];
}
int trashDataFile(const char * filename)
{
[Torrent trashFile: [NSString stringWithUTF8String: filename]];
return 0;
}
@implementation Torrent
- (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (torrentFileState) torrentDelete
@ -89,7 +95,7 @@ void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, vo
fPublicTorrentLocation = nil;
}
else if (!fPublicTorrent)
[self trashFile: path];
[Torrent trashFile: path];
else;
}
return self;
@ -453,14 +459,14 @@ void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, vo
- (void) trashData
{
[self trashFile: [self dataLocation]];
tr_torrentDeleteLocalData(fHandle, trashDataFile);
}
- (void) trashTorrent
{
if (fPublicTorrent)
{
[self trashFile: fPublicTorrentLocation];
[Torrent trashFile: fPublicTorrentLocation];
[fPublicTorrentLocation release];
fPublicTorrentLocation = nil;
@ -1968,7 +1974,7 @@ void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, vo
tr_free(trackerStructs);
}
- (void) trashFile: (NSString *) path
+ (void) trashFile: (NSString *) path
{
//attempt to move to trash
if (![[NSWorkspace sharedWorkspace] performFileOperation: NSWorkspaceRecycleOperation