]> granicus.if.org Git - transmission/commitdiff
fix path bug from r14034
authorMitchell Livingston <livings124@transmissionbt.com>
Tue, 19 Feb 2013 02:04:42 +0000 (02:04 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Tue, 19 Feb 2013 02:04:42 +0000 (02:04 +0000)
macosx/Torrent.m

index 2d352728670da4060a235e47ccaa0b82818cac0f..3fb0e32f1f21de7ff610c09cf0baf3d06261af04 100644 (file)
@@ -1726,7 +1726,7 @@ int trashDataFile(const char * filename)
         const NSInteger count = [self fileCount];
         NSMutableArray * flatFileList = [NSMutableArray arrayWithCapacity: count];
         
-        FileListNode * tempNode = [[FileListNode alloc] initWithFolderName:nil path:nil torrent:self];
+        FileListNode * tempNode = nil;
         
         for (NSInteger i = 0; i < count; i++)
         {
@@ -1734,6 +1734,10 @@ int trashDataFile(const char * filename)
             
             NSString * fullPath = [NSString stringWithUTF8String: file->name];
             NSArray * pathComponents = [fullPath pathComponents];
+            
+            if (!tempNode)
+                tempNode = [[FileListNode alloc] initWithFolderName:[pathComponents objectAtIndex: 0] path:@"" torrent:self];
+            
             [self insertPathForComponents: pathComponents withComponentIndex: 1 forParent: tempNode fileSize: file->length index: i flatList: flatFileList];
         }