#181: show first script directory in OS X app

If option “ScriptDir” contains multiple paths the menu command “Show in
Finder -> Scripts” of OS X application shows the first path contained
in option (instead of failing).
This commit is contained in:
Andrey Prygunkov
2016-03-03 23:38:34 +01:00
parent 27fc3b594b
commit 82ca298902

View File

@@ -410,6 +410,8 @@ void InstallSignalHandlers()
range:NSMakeRange(0, [dir length])];
}
dir = [[dir componentsSeparatedByCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@";,"]] objectAtIndex:0];
if (dir.length == 0 || ![[NSFileManager defaultManager] fileExistsAtPath:dir]) {
[NSApp activateIgnoringOtherApps:TRUE];
NSAlert *alert = [[NSAlert alloc] init];
@@ -418,7 +420,7 @@ void InstallSignalHandlers()
[alert runModal];
return;
}
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:@[[NSURL fileURLWithPath:dir isDirectory:YES]]];
}