Re: Finder Color Label [solved]
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