Skip to content

Commit

Permalink
MacGui: reset destination folder if the current folder is not available.
Browse files Browse the repository at this point in the history
  • Loading branch information
galad87 committed Apr 6, 2019
1 parent d7ac67a commit 525de85
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions macosx/HBController.m
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ - (instancetype)initWithQueue:(HBQueueController *)queueController presetsManage
_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];
Expand Down Expand Up @@ -1054,7 +1054,8 @@ - (void)runDestinationAlerts:(HBJob *)job completionHandler:(void (^ __nullable)
[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")];
Expand Down

0 comments on commit 525de85

Please sign in to comment.