Setting the color label
Setting the color label
- Subject: Setting the color label
- From: Chris Idou <email@hidden>
- Date: Wed, 9 Jul 2008 22:07:12 -0700 (PDT)
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 (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