Changeset 1085


Ignore:
Timestamp:
Nov 13, 2006, 2:45:28 PM (15 years ago)
Author:
livings124
Message:

Store location after it's set, incase the name isn't exactly what it was set to.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r1084 r1085  
    500500    }
    501501    else
    502     {
    503         NSString * path = [NSTemporaryDirectory() stringByAppendingPathComponent: [suggestedName lastPathComponent]];
    504         [download setDestination: path allowOverwrite: NO];
    505         [fPendingTorrentDownloads setObject: [NSDictionary dictionaryWithObjectsAndKeys:
     502        [download setDestination: [NSTemporaryDirectory() stringByAppendingPathComponent: [suggestedName lastPathComponent]]
     503                    allowOverwrite: NO];
     504}
     505
     506-(void) download: (NSURLDownload *) download didCreateDestination: (NSString *) path
     507{
     508    [fPendingTorrentDownloads setObject: [NSDictionary dictionaryWithObjectsAndKeys:
    506509                    path, @"Path", download, @"Download", nil] forKey: [[download request] URL]];
    507     }
    508510}
    509511
     
    522524- (void) downloadDidFinish: (NSURLDownload *) download
    523525{
    524     #warning try to open, if not delete
    525     [self openFiles: [NSArray arrayWithObject: [[fPendingTorrentDownloads objectForKey:
    526             [[download request] URL]] objectForKey: @"Path"]] ignoreDownloadFolder: NO forceDeleteTorrent: YES];
     526    NSString * path = [[fPendingTorrentDownloads objectForKey: [[download request] URL]] objectForKey: @"Path"];
     527   
     528    [self openFiles: [NSArray arrayWithObject: path] ignoreDownloadFolder: NO forceDeleteTorrent: YES];
    527529   
    528530    [fPendingTorrentDownloads removeObjectForKey: [[download request] URL]];
    529531    [download release];
     532   
     533    //delete torrent file if it wasn't already
     534    [[NSFileManager defaultManager] removeFileAtPath: path handler: nil];
    530535}
    531536
Note: See TracChangeset for help on using the changeset viewer.