]> granicus.if.org Git - handbrake/commitdiff
MacGui: reset destination folder if the current folder is not available.
authorDamiano Galassi <damiog@gmail.com>
Sat, 6 Apr 2019 10:28:19 +0000 (12:28 +0200)
committerDamiano Galassi <damiog@gmail.com>
Sat, 6 Apr 2019 10:28:19 +0000 (12:28 +0200)
macosx/HBController.m

index dd69c6834f622538e68885f1482c8a8a596e28c5..289c855e828bce34aadf0f146f220af785357543 100644 (file)
@@ -190,7 +190,7 @@ static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext;
         _currentDestination = [[NSUserDefaults standardUserDefaults] URLForKey:@"HBLastDestinationDirectoryURL"];
 #endif
 
-        if (!_currentDestination)
+        if (!_currentDestination || [[NSFileManager defaultManager] fileExistsAtPath:_currentDestination.path isDirectory:nil] == NO)
         {
             _currentDestination = [NSURL fileURLWithPath:[NSSearchPathForDirectoriesInDomains(NSMoviesDirectory, NSUserDomainMask, YES) firstObject]
                                              isDirectory:YES];
@@ -1054,7 +1054,8 @@ static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext;
         [alert setInformativeText:NSLocalizedString(@"This is not a valid destination directory!", @"Invalid destination alert -> informative text")];
         [alert beginSheetModalForWindow:self.window completionHandler:handler];
     }
-    else if ([job.fileURL isEqual:job.completeOutputURL])
+    else if ([job.fileURL isEqual:job.completeOutputURL]||
+             [job.fileURL.absoluteString.lowercaseString isEqualToString:job.completeOutputURL.absoluteString.lowercaseString])
     {
         NSAlert *alert = [[NSAlert alloc] init];
         [alert setMessageText:NSLocalizedString(@"A file already exists at the selected destination.", @"Destination same as source alert -> message")];