From b40bdcdeb2dde9f0132f0604c38c3c6a44c2413e Mon Sep 17 00:00:00 2001 From: Alex Zielenski Date: Sun, 31 Mar 2013 17:12:05 -0300 Subject: [PATCH] Use NSWorkspace's method for revealing in finder It is more reliable than applescript and works for Path Finder users as well --- appshell/appshell_extensions_mac.mm | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/appshell/appshell_extensions_mac.mm b/appshell/appshell_extensions_mac.mm index e91f1b52e..b76e82e17 100644 --- a/appshell/appshell_extensions_mac.mm +++ b/appshell/appshell_extensions_mac.mm @@ -604,11 +604,7 @@ - (void) timeoutTimer:(NSTimer*)timer int32 ShowFolderInOSWindow(ExtensionString pathname) { - NSString* scriptString = [NSString stringWithFormat: @"activate application \"Finder\"\n tell application \"Finder\" to open posix file \"%s\"", pathname.c_str()]; - NSAppleScript* script = [[NSAppleScript alloc] initWithSource: scriptString]; - NSDictionary* errorDict = nil; - [script executeAndReturnError: &errorDict]; - [script release]; + [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:[NSArray arrayWithObject: [NSURL fileURLWithPath: pathname.c_str()]]]; return NO_ERROR; }