NSWorkspace: Throw a descriptive exception when make_services could not be found (#208)

`[NSTask launchPathForTool: @"make_services"]; can return nil when the tool is not found. In this case, [NSTask launchedTaskWithLaunchPath] would raise a NSInvalidArgumentException with error message "NSTask - no launch path set" which is not very descriptive.
This commit is contained in:
Frederik Carlier 2023-10-11 17:54:38 +02:00 committed by GitHub
parent 8619fe33c2
commit 31a71a1090
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1746,6 +1746,13 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
{
path = [[NSTask launchPathForTool: @"make_services"] retain];
}
if (path == nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"Unable to find the make_services tool.\n"];
}
task = [NSTask launchedTaskWithLaunchPath: path
arguments: nil];
if (task != nil)