In my application I would like to create a 'Show in Finder' button.
I have been able to figure out how to pop up a Finder window of that directory but haven't figured out how to highlight the file like the OS does.
Is this possible?
NSArray *fileURLs = [NSArray arrayWithObjects:fileURL1, /* ... */ nil]; [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:fileURLs];
stolen from Launch OSX Finder window with specific files selected
You can use NSWorkspace
method -selectFile:inFileViewerRootedAtPath:
like this:
[[NSWorkspace sharedWorkspace] selectFile:fullPathString inFileViewerRootedAtPath:pathString];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With