Search code examples
macoscachingiconsfinder

How to programatically tell the Mac Finder to redraw a folder or file icon?


I have a process that modifies icons on files with an overlay. The Finder, though, seems to be caching the images it generates, which sometimes happens after I generate the overlay (in the case of the icon being a preview of the file instead of a plain icon).

Is there a programatic way I can tell the Finder to dump its cache for an icon image, and recreate it, without changing the file information, specifically the modification date?


Solution

  • Check: NSWorkspace Class Reference

    Refresh the Finder like this:

    [[NSWorkspace sharedWorkspace] noteFileSystemChanged:path];