From 4df8705d82ed0488f93776290291c03da990cc19 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Wed, 24 Dec 2008 01:55:33 +0000 Subject: [PATCH] (Mac client) #1029: When removing local data only remove data from the torrent --- macosx/Torrent.m | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/macosx/Torrent.m b/macosx/Torrent.m index da081990c..cabb1cb5e 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -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