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

This commit is contained in:
Mitchell Livingston 2008-12-20 19:12:09 +00:00
parent a68764fcba
commit efa404ff25
2 changed files with 12 additions and 5 deletions

2
NEWS
View File

@ -6,7 +6,7 @@ NEWS file for Transmission <http://www.transmissionbt.com/>
- All Platforms
+ Support BitTorrent Enhancement Proposal #6 "Fast Extension"
+ Support BitTorrent Enhancement Proposal #21 "Extension for Partial Seeds"
+ IPv6 Support
+ IPv6 support
+ Random port, with optional randomization on startup
- Mac
+ Groups (moved to preferences) can be auto-assigned to transfers when adding based on name and tracker (10.5-only)

View File

@ -459,18 +459,25 @@ void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, vo
NSString * file;
while ((file = [enumerator nextObject]))
{
if ([[file lastPathComponent] hasPrefix: @"."])
NSArray * actualComponents = [file pathComponents];
if ([[actualComponents lastObject] hasPrefix: @"."])
continue;
file = [[self name] stringByAppendingPathComponent: file];
BOOL isExtra = YES;
NSEnumerator * nodeEnumerator = [fFlatFileList objectEnumerator];
FileListNode * node;
while ((node = [nodeEnumerator nextObject]))
{
#warning this could be more thorough
if ([[node fullPath] hasPrefix: file])
NSArray * listedComponents = [[node fullPath] pathComponents];
if ([listedComponents count]-1 < [actualComponents count])
continue;
//remove first component (the folder name) and only include the same number of levels
listedComponents = [listedComponents objectsAtIndexes: [NSIndexSet indexSetWithIndexesInRange:
NSMakeRange(1, [actualComponents count])]];
if ([listedComponents isEqualToArray: actualComponents])
{
isExtra = NO;
break;