Am currently working on a project, and though I can add sidebar items by adding to the com.apple.sidebarlists.plist file then restarting Finder, I can't seem to know how to make the folder icons show up using its assigned custom icon.
Can anyone point me to a link or a solution that would make me do this? Thanks a bunch in advance!
There's no supported way to do this using pure Cocoa. Use the LSSharedFileList API, instead. It's the supported way to manage the sidebar lists, and you can provide a custom icon (as an IconRef from Icon Services) when you insert an item.
I don't know about the icons but I add items to the sidebar using the EBLaunchServices
wrapper which is available open source here:
https://github.com/Eric-Bro/EBLaunchServices
It is very easy to use. For instance to add a mounted OSXFUSE volume to the sidebar you call:
NSURL* volumeUrl = [NSURL fileURLWithPath:@"/Volumes/MyVolume"];
[EBLaunchServices addItemWithURL:volumeUrl toList:kLSSharedFileListFavoriteVolumes];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With