Changeset 6255


Ignore:
Timestamp:
Jun 26, 2008, 3:50:21 AM (13 years ago)
Author:
livings124
Message:

delete the torrent file right after it finishes downloading and is opened (when opening the torrent through a url)

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.h

    r6254 r6255  
    114114   
    115115    NSMutableDictionary             * fPendingTorrentDownloads;
    116     NSMutableArray                  * fTempTorrentFiles;
    117116   
    118117    BOOL                            fSoundPlaying;
  • trunk/macosx/Controller.m

    r6254 r6255  
    569569        NSEnumerator * downloadEnumerator = [[fPendingTorrentDownloads allValues] objectEnumerator];
    570570        NSDictionary * downloadDict;
    571         NSURLDownload * download;
    572571        while ((downloadDict = [downloadEnumerator nextObject]))
    573572        {
    574             download = [downloadDict objectForKey: @"Download"];
     573            NSURLDownload * download = [downloadDict objectForKey: @"Download"];
    575574            [download cancel];
    576575            [download release];
    577576        }
    578577        [fPendingTorrentDownloads removeAllObjects];
    579     }
    580    
    581     //remove all remaining torrent files in the temporary directory
    582     if (fTempTorrentFiles)
    583     {
    584         NSEnumerator * torrentEnumerator = [fTempTorrentFiles objectEnumerator];
    585         NSString * path;
    586         while ((path = [torrentEnumerator nextObject]))
    587             [[NSFileManager defaultManager] removeFileAtPath: path handler: nil];
    588578    }
    589579   
     
    610600    [fAutoImportedNames release];
    611601    [fPendingTorrentDownloads release];
    612     [fTempTorrentFiles release];
    613602   
    614603    //complete cleanup
     
    674663   
    675664    [fPendingTorrentDownloads removeObjectForKey: [[download request] URL]];
     665    if ([fPendingTorrentDownloads count] == 0)
     666    {
     667        [fPendingTorrentDownloads release];
     668        fPendingTorrentDownloads = nil;
     669    }
     670   
    676671    [download release];
    677672}
     
    683678    [self openFiles: [NSArray arrayWithObject: path] addType: ADD_URL forcePath: nil];
    684679   
     680    [[NSFileManager defaultManager] removeFileAtPath: path handler: nil]; //delete the torrent file after opening
     681   
    685682    [fPendingTorrentDownloads removeObjectForKey: [[download request] URL]];
     683    if ([fPendingTorrentDownloads count] == 0)
     684    {
     685        [fPendingTorrentDownloads release];
     686        fPendingTorrentDownloads = nil;
     687    }
     688   
    686689    [download release];
    687    
    688     //delete temp torrent file on quit
    689     if (!fTempTorrentFiles)
    690         fTempTorrentFiles = [[NSMutableArray alloc] init];
    691     [fTempTorrentFiles addObject: path];
    692690}
    693691
Note: See TracChangeset for help on using the changeset viewer.