Changeset 7440


Ignore:
Timestamp:
Dec 20, 2008, 7:12:09 PM (12 years ago)
Author:
livings124
Message:

more thorough check of files in a folder when attempting to trash it

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEWS

    r7437 r7440  
    77   + Support BitTorrent Enhancement Proposal #6 "Fast Extension"
    88   + Support BitTorrent Enhancement Proposal #21 "Extension for Partial Seeds"
    9    + IPv6 Support
     9   + IPv6 support
    1010   + Random port, with optional randomization on startup
    1111- Mac
  • trunk/macosx/Torrent.m

    r7315 r7440  
    460460        while ((file = [enumerator nextObject]))
    461461        {
    462             if ([[file lastPathComponent] hasPrefix: @"."])
     462            NSArray * actualComponents = [file pathComponents];
     463            if ([[actualComponents lastObject] hasPrefix: @"."])
    463464                continue;
    464465           
    465             file = [[self name] stringByAppendingPathComponent: file];
    466466            BOOL isExtra = YES;
    467467       
     
    470470            while ((node = [nodeEnumerator nextObject]))
    471471            {
    472                 #warning this could be more thorough
    473                 if ([[node fullPath] hasPrefix: file])
     472                NSArray * listedComponents = [[node fullPath] pathComponents];
     473                if ([listedComponents count]-1 < [actualComponents count])
     474                    continue;
     475               
     476                //remove first component (the folder name) and only include the same number of levels
     477                listedComponents = [listedComponents objectsAtIndexes: [NSIndexSet indexSetWithIndexesInRange:
     478                                    NSMakeRange(1, [actualComponents count])]];
     479               
     480                if ([listedComponents isEqualToArray: actualComponents])
    474481                {
    475482                    isExtra = NO;
Note: See TracChangeset for help on using the changeset viewer.