Skip to content

Instantly share code, notes, and snippets.

@nesium
Created April 24, 2010 14:02
Show Gist options
  • Save nesium/377675 to your computer and use it in GitHub Desktop.
Save nesium/377675 to your computer and use it in GitHub Desktop.
Get Finder color label
- (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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment