I am developing an application in which I have to mark a set of files/folder. The marked files/folder when viewed in Finder must be shown with a custom icon. But when they are selected for preview ( using spacebar) they must show their original icon ( i.e the blue icon for folder etc) .
This behavior is similar to symbolic links in the fact that for symbolic links , an arrow comes at the lower left corner of the icon whereas when we preview it , it shows the icon of the file/folder it is pointing to (without the arrow) .
Now I went over [[NSWorkspace sharedWorkspace] setIcon:icon forFile:@"path" options:NSExcludeQuickDrawElementsIconCreationOption];
But it sets the icon of the path permanently and the same custom icon appears when I preview it .
I tried to register a custom file type but the same problem happened . The custom icon also appeared in the preview.
Can anyone please help me out ?? Thanks :)
Starting with OS X 10.6, you will need to inject code into the Finder process and override objective C methods in the Finder process. Refer How to Write OS X Finder plugin post.