ping localhost
ping localhost

Reputation: 479

Custom icon for Mac application

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 :)

Upvotes: 0

Views: 898

Answers (2)

Parag Bafna
Parag Bafna

Reputation: 22930

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.

Upvotes: 0

Nils Munch
Nils Munch

Reputation: 8846

Symbolic links are not just documents, but a special entity in the OS, and therefor gets special treatments in some cases.

If you use setIcon:forFile: to set an icon, I do not believe there are any options to say that the icon should only appear in directory view, and not in preview.

Upvotes: 0

Related Questions