Thanks, Ted. Very helpful.
Am I correct in believing that the value returned from getxattr
("com.apple.FinderInfo") is always 32 bytes long in big-endian order?
That seems to be what the ObjC code you pointed to implies.
Bill
On Dec 9, 9:27 pm, "ted bonkenburg" <[email protected]> wrote:
> On Tue, Dec 9, 2008 at 7:52 PM, Bill <[email protected]> wrote:
>
> > I'm trying the very nifty new ctypes-based Python binding to FUSE by
> > Giorgos Verigakis (http://code.google.com/p/fusepy/) with MacFUSE, and
> > am at the point of wanting custom folder icons. It's a bit tricky
> > getting custom icons for files; you have to generate a valid OS X HFS+
> > resource fork containing the icon in Apple's '.icns' format, a format
> > not supported in many image processing suites, and pass it back in
> > response to getxattr(*, 'com.apple.ResourceFork'). But I've got that
>
> I believe you also need to return com.apple.FinderInfo data with the
> kHasCustomIcon bit set. Did you manage to get custom icons working
> without doing this?
>
> The Objective-C framework has some code (BSD-style license) that
> generates FinderInfo and ResourceFork data. You might find that
> useful. See GMFinderInfo.{h,m} and GMResourceFork.{h,m} here:
>
> http://macfuse.googlecode.com/svn/trunk/core/sdk-objc/
>
> > working. Will that also work for folders?
>
> Sort of. I got this working in the Objective-C API for MacFUSE on
> Tiger and Leopard, so I should be able to help you. I can't quite
> remember all of the details but I took a look through the Objective-C
> API code to see what it is doing (see below).
>
> First of all, I'll assume you don't need to support Tiger. If you do,
> then there are other hoops that you need to jump through. I can go
> over that if need be but will skip for now.
>
>
>
> > I've been told that the way to do it with folders is different; you
> > create a file called 'Icon\r' (yes, containing a carriage return), and
> > put it in the folder, to give a folder a custom icon. I find that
> > hard to believe...
>
> That is part of what you need to do. The "Icon\r" file should reside
> in the directory that you want to have a custom icon. It should be an
> empty file. The Objective-C framework gives it a com.apple.FinderInfo
> that has the kHasCustomIcon and kIsInvisible flags set. The
> com.apple.ResourceFork data of the "Icon\r" file is the same resource
> fork data that you would need to return for a custom icon on a
> standard file. I believe the "Icon\r" file was used because a
> directory could not have a resource fork. On Leopard you do not need
> the "Icon\r" file in the directory listing. However, it should be able
> to be stat'd directly. Finally, the Objective-C framework returns a
> com.apple.FinderInfo on the directory itself with the kHasCustomIcon
> bit set.
>
> Let me know if this works for you.
>
> ted
>
>
>
> > Thanks for any tips.
>
> > Bill
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MacFUSE" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/macfuse?hl=en
-~----------~----~----~----~------~----~------~--~---