Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 617
Mel Avatar asked Nov 30 '25 14:11

Mel


1 Answers

Check: NSWorkspace Class Reference

Refresh the Finder like this:

[[NSWorkspace sharedWorkspace] noteFileSystemChanged:path];
like image 185
Anne Avatar answered Dec 03 '25 12:12

Anne



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!