Changeset 8473


Ignore:
Timestamp:
May 22, 2009, 2:52:28 AM (14 years ago)
Author:
livings124
Message:

cleanup last commit(s)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Torrent.m

    r8471 r8473  
    15931593@implementation Torrent (Private)
    15941594
    1595 //if a hash is given, attempt to load that; otherwise, attempt to open file at path
    15961595- (id) initWithPath: (NSString *) path hash: (NSString *) hashString torrentStruct: (tr_torrent *) torrentStruct lib: (tr_session *) lib
    15971596        publicTorrent: (NSNumber *) publicTorrent
     
    16371636        tr_ctorSetPeerLimit(ctor, TR_FALLBACK, [fDefaults integerForKey: @"PeersTorrent"]);
    16381637       
    1639         tr_info info;
    16401638        int result = TR_EINVALID;
    16411639        if (path)
    1642         {
    1643             tr_ctorSetMetainfoFromFile(ctor, [path UTF8String]);
     1640            result = tr_ctorSetMetainfoFromFile(ctor, [path UTF8String]);
     1641       
     1642        //backup - shouldn't be needed after upgrade to 1.62
     1643        if (result != TR_OK && hashString)
     1644            tr_ctorSetMetainfoFromHash(ctor, [hashString UTF8String]);
     1645       
     1646        if (result == TR_OK)
     1647        {
     1648            tr_info info;
    16441649            result = tr_torrentParse(ctor, &info);
    1645         }
    1646         if (result != TR_OK && hashString) //backup - shouldn't be needed after upgrade to 1.70
    1647         {
    1648             tr_ctorSetMetainfoFromHash(ctor, [hashString UTF8String]);
    1649             result = tr_torrentParse(ctor, &info);
    1650         }
    1651        
    1652         if (result == TR_OK)
    1653         {
    1654             NSString * currentDownloadFolder = [self shouldUseIncompleteFolderForName: [NSString stringWithUTF8String: info.name]]
    1655                                                 ? fIncompleteFolder : fDownloadFolder;
    1656             tr_ctorSetDownloadDir(ctor, TR_FORCE, [currentDownloadFolder UTF8String]);
    16571650           
    1658             fHandle = tr_torrentNew(ctor, NULL);
    1659         }
    1660         if (result != TR_EINVALID)
    1661             tr_metainfoFree(&info);
     1651            if (result == TR_OK)
     1652            {
     1653                NSString * currentDownloadFolder = [self shouldUseIncompleteFolderForName: [NSString stringWithUTF8String: info.name]]
     1654                                                    ? fIncompleteFolder : fDownloadFolder;
     1655                tr_ctorSetDownloadDir(ctor, TR_FORCE, [currentDownloadFolder UTF8String]);
     1656               
     1657                fHandle = tr_torrentNew(ctor, NULL);
     1658            }
     1659            if (result != TR_EINVALID)
     1660                tr_metainfoFree(&info);
     1661        }
    16621662       
    16631663        tr_ctorFree(ctor);
Note: See TracChangeset for help on using the changeset viewer.