My question is about opening a Finder window to show the file.
To open a single file, able to do by this :
[[NSWorkspace sharedWorkspace] selectFile:file.path
inFileViewerRootedAtPath:file.path];
Now I need to have a single Finder if user tries to open the same file.path
.
To achieve this, I add file.path
in an array.
But I am stuck when user closes the Finder
window and again tries to open the file (as the active window has THE array with the path). Then Finder doesn't show :(
Any help how to proceed on this.
Is there a way to check the path for which the Finder
window is open?
Is there a way to get a callback for the finder, so that I can remove the file.path
from the array?
It is done by simply passing nil
.
[[NSWorkspace sharedWorkspace] selectFile:file.path inFileViewerRootedAtPath:nil];
Now same file / folder is selected even on multiple clicks.