I want to color badge files and folders based on the some condition in finder, what is the approach to achieve this in Mac OS X 10.6
I have checked this question: Th
You can use the URL Resource API, which was introduced in Mac OS X 10.6.
NSURL* fileURL = [NSURL fileURLWithPath:@"/Path/to/file"];
id labelValue = nil;
NSError* error;
if([fileURL getResourceValue:&labelValue forKey:NSURLLabelNumberKey error:&error])
{
NSLog(@"The label value is %@",labelValue);
}
else
{
NSLog(@"An error occurred: %@",[error localizedDescription]);
}
You can use both the NSURLLabelNumberKey to get the number of the Finder's assigned label or the NSURLLabelColorKey to get the actual color.
You can set the label values by using the corresponding method:
- (BOOL)setResourceValue:(id)value forKey:(NSString *)key error:(NSError **)error