diff options
author | Damiano Galassi <[email protected]> | 2017-11-11 08:39:00 +0100 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2017-11-11 08:39:00 +0100 |
commit | 501055d74f3ee8278d8e03b96e24007876b4652d (patch) | |
tree | f1b579f85b598dc7d7f90f62258e005424ba1af2 /macosx/HBJob.m | |
parent | 2a5df5af77d559f66355c984a56a7932260b0ceb (diff) |
MacGui: do not allow the path separator "/" character to be inserted in the output file name.
Diffstat (limited to 'macosx/HBJob.m')
-rw-r--r-- | macosx/HBJob.m | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/macosx/HBJob.m b/macosx/HBJob.m index 8c672445e..d90d95be0 100644 --- a/macosx/HBJob.m +++ b/macosx/HBJob.m @@ -166,6 +166,25 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification"; _outputFileName = [outputFileName copy]; } +- (BOOL)validateOutputFileName:(id *)ioValue error:(NSError * __autoreleasing *)outError +{ + BOOL retval = YES; + + if (nil != *ioValue) + { + NSString *value = *ioValue; + + if ([value rangeOfString:@"/"].location != NSNotFound) + { + *outError = [NSError errorWithDomain:@"HBError" code:0 userInfo:@{NSLocalizedDescriptionKey: NSLocalizedString(@"Invalid name", nil), + NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"The file name can't contain the / character.", nil)}]; + return NO; + } + } + + return retval; +} + - (NSURL *)completeOutputURL { return [self.outputURL URLByAppendingPathComponent:self.outputFileName]; |