Changeset 299


Ignore:
Timestamp:
Jun 8, 2006, 6:59:04 AM (17 years ago)
Author:
livings124
Message:

As far as I can see this is now working. Some cosmetic touchups are needed for the interface and it needs a bit more testing, but it's getting there...

Location:
branches/save_torrent_files
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/save_torrent_files/libtransmission/metainfo.c

    r289 r299  
    121121        if( !file )
    122122        {
    123             fprintf( stderr, "Could not open file (%s)\n", inf->torrent );
     123            fprintf( stderr, "Could not open file (%s) (%s)\n", inf->torrent, strerror(errno) );
    124124            tr_bencFree( &meta );
    125125            free( buf );
  • branches/save_torrent_files/macosx/Torrent.h

    r294 r299  
    4040    NSDate       * fDate;
    4141   
    42     BOOL        fPrivateSaved;
     42    BOOL        fPrivateTorrent;
    4343
    4444    NSUserDefaults  * fDefaults;
  • branches/save_torrent_files/macosx/Torrent.m

    r295 r299  
    4444
    4545- (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib
    46 {NSLog(path);
     46{
    4747    id torrent = [self initWithPath: path lib: lib date: nil
    4848                    stopRatioSetting: nil ratioLimit: nil];
     
    5151        return nil;
    5252
    53     if (fPrivateSaved && [fDefaults boolForKey: @"DeleteOriginalTorrent"])
     53    if (fPrivateTorrent && [fDefaults boolForKey: @"DeleteOriginalTorrent"])
    5454        [self trashPath: path];
    5555   
     
    5959- (id) initWithHistory: (NSDictionary *) history lib: (tr_handle_t *) lib
    6060{
     61    //load from saved torrent file if set to, otherwise try to load from where torrent file should be
    6162    NSNumber * privateCopy;
    6263    if ((privateCopy = [history objectForKey: @"PrivateCopy"]) && [privateCopy boolValue])
     
    8990{
    9091    NSMutableDictionary * history = [NSMutableDictionary dictionaryWithObjectsAndKeys:
    91                     [NSNumber numberWithBool: fPrivateSaved], @"PrivateCopy",
     92                    [NSNumber numberWithBool: fPrivateTorrent], @"PrivateCopy",
    9293                    [self downloadFolder], @"DownloadFolder",
    9394                    [self isActive] ? @"NO" : @"YES", @"Paused",
     
    9697                    [NSNumber numberWithFloat: fRatioLimit], @"RatioLimit", nil];
    9798           
    98     if (fPrivateSaved)
     99    if (fPrivateTorrent)
     100        [history setObject: [self hashString] forKey: @"TorrentHash"];
     101    else
    99102        [history setObject: [self torrentLocation] forKey: @"TorrentPath"];
    100     else
    101         [history setObject: [self hashString] forKey: @"TorrentHash"];
    102103   
    103104    return history;
     
    240241- (void) removeForever
    241242{
    242     tr_torrentRemoveSaved(fHandle);
     243    if (fInfo->flags & TR_FSAVEPRIVATE)
     244        tr_torrentRemoveSaved(fHandle);
    243245}
    244246
     
    508510    fDefaults = [NSUserDefaults standardUserDefaults];
    509511
    510     fPrivateSaved = [fDefaults boolForKey: @"SavePrivateTorrent"];
     512    fPrivateTorrent = [fDefaults boolForKey: @"SavePrivateTorrent"];
    511513
    512514    int error;
    513515    if (!path || !(fHandle = tr_torrentInit(fLib, [path UTF8String],
    514                     fPrivateSaved ? TR_FSAVEPRIVATE : 0, & error)))
     516                    fPrivateTorrent ? TR_FSAVEPRIVATE : 0, & error)))
    515517    {
    516518        [self release];
     
    530532    fDefaults = [NSUserDefaults standardUserDefaults];
    531533   
    532     fPrivateSaved = YES;
     534    fPrivateTorrent = YES;
    533535
    534536    int error;
Note: See TracChangeset for help on using the changeset viewer.