• 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
Re: Finder Color Label [solved]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finder Color Label [solved]


  • Subject: Re: Finder Color Label [solved]
  • From: Patrick Gleichmann <email@hidden>
  • Date: Thu, 25 Aug 2005 21:19:27 +0200

Thanks alot.

On 24.08.2005, at 15:33, Jim Correia wrote:

On Aug 24, 2005, at 9:26 AM, Daniel Stødle wrote:

Use FSGetCatalogInfo to get the info for the file, requesting only the Finder Info.

Here is my solution:

static NSColor* finderColors[8]; // kColor >> kIsOnDesk + 1

+ (void)initialize {
  finderColors[0]  = [NSColor blackColor];
  finderColors[1]  = [NSColor grayColor];
  // :
}

- (int)_finderLabelColorOfPath:(NSString*)path {
  CFURLRef       url;
  FSRef          fsRef;
  BOOL           ret;
  FSCatalogInfo  cinfo;

// Get FSRef
url = CFURLCreateWithFileSystemPath(NULL, (CFStringRef)path, kCFURLPOSIXPathStyle, FALSE);
if (!url)
return 0;
ret = CFURLGetFSRef(url, &fsRef);
CFRelease(url);


// Get Finder flags
if (ret &&
(FSGetCatalogInfo(&fsRef, kFSCatInfoFinderInfo, &cinfo, NULL, NULL, NULL) == noErr))
return (((FileInfo*)&cinfo.finderInfo)->finderFlags & kColor) >> kIsOnDesk;
return 0;
}


// :
  m_textCol = finderColors[ [self _finderLabelColorOfPath:path] ];

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Finder Color Label (From: Daniel Stødle <email@hidden>)
 >Re: Finder Color Label (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: Finding all subclasses of a class ?
  • Next by Date: RE: Alloc Mocks my World
  • Previous by thread: Re: Finder Color Label
  • Next by thread: Query regarding .string file encoding
  • Index(es):
    • Date
    • Thread