Ignore:
Timestamp:
Dec 31, 2009, 6:55:14 PM (12 years ago)
Author:
livings124
Message:

avoid copying file paths when unnecessary

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Torrent.m

    r9842 r9843  
    16161616           
    16171617            NSString * fullPath = [NSString stringWithUTF8String: file->name];
    1618             NSMutableArray * pathComponents = [[NSMutableArray alloc] initWithArray: [fullPath pathComponents]];
     1618            NSArray * pathComponents = [fullPath pathComponents];
    16191619            NSAssert1([pathComponents count] >= 2, @"Not enough components in path %@", fullPath);
    16201620           
     
    16241624            if ([pathComponents count] > 2)
    16251625            {
    1626                 [pathComponents removeObjectsAtIndexes: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, 2)]];
    1627                
    16281626                //determine if folder node already exists
    16291627                FileListNode * node;
     
    16391637                }
    16401638               
     1639                NSMutableArray * trimmedComponents = [NSMutableArray arrayWithArray: [pathComponents subarrayWithRange:
     1640                                                        NSMakeRange(2, [pathComponents count]-2)]];
     1641               
    16411642                [node insertIndex: i withSize: file->length];
    1642                 [self insertPath: pathComponents forParent: node fileSize: file->length index: i flatList: flatFileList];
     1643                [self insertPath: trimmedComponents forParent: node fileSize: file->length index: i flatList: flatFileList];
    16431644            }
    16441645            else
     
    16491650                [node release];
    16501651            }
    1651            
    1652             [pathComponents release];
    16531652        }
    16541653       
Note: See TracChangeset for help on using the changeset viewer.