Correct code for Path Finder vs. Finder integration?

Chris Hill's Avatar

Chris Hill

02 Apr, 2013 04:08 PM

I'm a big fan of Path Finder and I'd like to request that my text editor of choice(Sublime) work with it better. It has a 'reveal in finder' feature, which....reveals in finder, but not Path Finder!

Looking around it seems that the normal 'reveal in finder' method is:

    NSURL* url = [NSURL URLWithString:@"file:///Users/chrishill/Pictures/fry-face.png"];
    NSArray *fileURLs = [NSArray arrayWithObjects:url,nil];
    [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:fileURLs];
This doesn't open in Path Finder on my machine.

But I have noticed that some programs, Cornerstone for example, work well with Path Finder. I would like to, for future reference, know what code is necessary to, say, detect the user's Finder 'preference' and open it in the correct program. Can you help at all?

Thanks!
Chris

  1. Support Staff 1 Posted by Dragan on 12 Apr, 2013 10:58 AM

    Dragan's Avatar

    Chris, the NSWorkspace method you've mentioned selects files in Finder only. The correct one would be -[NSWorkspace selectFile:inFileViewerRootedAtPath:].It's not very well documented how it works, but the old release notes from Apple, somewhere in the 10.4 section you'll find this quote:

    The method selectFile:inFileViewerRootedAtPath: now consults a user default named "NSFileViewer", and if present, uses it as the bundle ID of the application to use as the file viewer to select the file in. If this default is not set, or there is no corresponding registered application, then Finder is used as normal. selectFile:inFileViewerRootedAtPath: is the method applications should use for "Reveal in Finder" functionality.

  2. Dragan closed this discussion on 12 Apr, 2013 10:58 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac