• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Setting the color label
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Setting the color label
      • From: "Adam R. Maxwell" <email@hidden>
  • Prev by Date: Re: [Q] How to highlighted text remained as highlighted?
  • Next by Date: Re: How to indent in NSOutlineView?
  • Previous by thread: Re: NSTableView prematurely posts selection changed notification
  • Next by thread: Re: Setting the color label
  • Index(es):
    • Date
    • Thread