Created
April 24, 2010 14:02
-
-
Save nesium/377675 to your computer and use it in GitHub Desktop.
Get Finder color label
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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