Re: Setting the bundle bit [Was: Re: UTI's and document packages]
Re: Setting the bundle bit [Was: Re: UTI's and document packages]
- Subject: Re: Setting the bundle bit [Was: Re: UTI's and document packages]
- From: Alastair Houghton <email@hidden>
- Date: Tue, 27 Nov 2007 10:58:48 +0000
On 27 Nov 2007, at 09:36, Antonio Nunes wrote:
1. I'm not sure UTF8String for the path is the correct encoding.
-UTF8String and -cString are *never* right for paths. You should be
using
-fileSystemRepresentation.
2. The path could of course be either a folder or a file, but it
shouldn't matter whether the code coerces it to FileInfo or
FolderInfo in this case.
Since you're talking about setting the bundle bit, it must be a
FolderInfo, surely? In fact, it would be a good thing to check for a
folder and error out if you don't get one.
3. I take it there is no Apple provided Cocoa API for this purpose.
(At least, I couldn't find any.)
4. Is there otherwise anything wrong with this code, or anything I
should be aware of?
I don't know that the finderInfo structure is byte-swapped when it's
retrieved, even via FSGetCatalogInfo(). As a result, you might need
to check whether you're on an Intel machine or not.
AFAIK the only other option you have besides these functions is the
getattrlist()/setattrlist() functions. But FSGet/SetCatalogInfo() has
the advantage that the Carbon layer includes emulation code to provide
support for filesystems other than HFS and HFS+. Since the emulation
is based on the AppleDouble format, it's very likely that you can
successfully set the bundle bit on a folder on e.g. a FAT filesystem
using those APIs (I haven't tried it myself).
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden