]> granicus.if.org Git - handbrake/commitdiff
MacGui: check for duplicated file names when adding a batch of jobs.
authorritsuka <damiog@gmail.com>
Sat, 28 Feb 2015 11:30:45 +0000 (11:30 +0000)
committerritsuka <damiog@gmail.com>
Sat, 28 Feb 2015 11:30:45 +0000 (11:30 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6946 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/HBController.m

index 270b401862ed4d99bc5902f1c88458cedc1836b1..85d0fd12e025f705ecad068333ecc1c02613d43a 100644 (file)
             job.title = nil;
             [jobs addObject:job];
             [job release];
+        }
+    }
 
-            if ([[NSFileManager defaultManager] fileExistsAtPath:job.destURL.path] || [fQueueController jobExistAtURL:job.destURL])
-            {
-                fileExists = YES;
-            }
+    NSMutableSet *destinations = [[NSMutableSet alloc] init];
+    for (HBJob *job in jobs)
+    {
+        if ([destinations containsObject:job.destURL])
+        {
+            fileExists = YES;
+            break;
+        }
+        else
+        {
+            [destinations addObject:job.destURL];
+        }
+
+        if ([[NSFileManager defaultManager] fileExistsAtPath:job.destURL.path] || [fQueueController jobExistAtURL:job.destURL])
+        {
+            fileExists = YES;
+            break;
         }
     }
+    [destinations release];
 
     if (fileExists)
     {