Mysterious OS X File Extension (bug?)

I know that OS X uses the Launch Services.framework to manage the file-extensions. But the icons which belong to the file-extension are part of the Info.plist in the package contents of the 'default-opening-application' of that specific file-extension.

My 'buggy' file-extension is *.cpp used by Xcode as default. Normally it should use the icon given in /applications/xcode/contens/ressources/XXX.icns.

But it doesn't! It's using another cpp icon, which i couldn't find in my whole system - in the Xcode app neither.

After I changed the XXX.icns mentioned above with a custom .icns file and cleared my Icon cache, logged out and restarted my mac:

For roundabout 2 seconds I could see my custom .icns file as the standard icon for the file-extension cpp. This is actually what I want to achieve permanently!

But after a few seconds the icon changes by magic into the other cpp icon, which I can't find on my mac. What is wrong with my Mac.

Little Conclusion:

  1. 1 icon that is not to find in any lib or app
  2. 1 icon that is default in Xcode for example
  3. 1 icon that I want to use for an extension

The (1) icon is shown. But it shouldn't. It should show the (3) if I did everything right, otherwise it needs to show (2).

(1) is the icon shown in the finder (2) is the icon shown in the inspector:

Icon 1

Here is the icons I want to use:

Icons to be used


Turn off 'Show icon preview' (in german: Symbolvorschau einblenden) in the view options of the specific folder or all folders and you will probably see your custom icon.

If you want to apply this to all folders click the “Use as Defaults” button.

enter image description here