I came up with the code below to set the color label. Questions:

1) Is it really necessary to do a FSGetCatalogInfo first? I presume it is 
because otherwise the FSSetCatalogInfo wouldn't know what fields of 
catalogInfo.finderInfo it is supposed to be updating, or even what bits of 
catalogInfo.fileInfo->finderFlags.

2) I'm casting finderInfo to a (FileInfo *). But from the header files it also 
mentions the FolderInfo structure in conjunction with the finderInfo member. 
From my looking at FileInfo and FolderInfo it appears as if the finderFlags are 
at different offsets in the structures. Am I supposed to check if it is a 
directory and cast it to one or the other depending on the result?

I'm confused!


int c = 7; // Orange
FSRef ref;
if (FSPathMakeRef((UInt8 *)[[path UTF8String], &ref, nil) < 0) {
        return NO;
}
FSCatalogInfo catalogInfo;
FileInfo *fileInfo = (FileInfo *)catalogInfo.finderInfo;

FSGetCatalogInfo(&ref, kFSCatInfoFinderInfo, &catalogInfo, nil, nil nil);
        
fileInfo->finderFlags &= ~kColor;
fileInfo->finderFlags |= (c << 1)
        
if (FSSetCatalogInfo(ref, kFSCatInfoFinderInfo, &catalogInfo) < 0) {
   return NO;
}




      
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to