mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
more thorough check of files in a folder when attempting to trash it
This commit is contained in:
parent
a68764fcba
commit
efa404ff25
2 changed files with 12 additions and 5 deletions
2
NEWS
2
NEWS
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue