I myself got the path to the attributes of the request file / directory. It's simple.
Get the attributes of the file you want to show the progress bar on the icon
NSDictionary *fileAttr = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:nil];
Get extension attributes
NSDictionary *extendAttr = [fileAttr objectForKey:@"NSFileExtendedAttributes"];
Create a Mutable copy of extendAttr and change some value in it
NSMutableDictionary *mutableExtendAttr = [NSMutableDictionary dictionaryWithDictionary:extendAttr]; // create data of progress value NSData *progressData = [@"0.1" dataUsingEncoding:NSASCIIStringEncoding]; // change it [mutableExtendAttr setObject:progressData forKey:@"com.apple.progress.fractionCompleted"];
Create a modified copy of FileAttr
NSMutableDictionary *mutableFileAttr = [NSMutableDictionary dictionaryWithDictionary:fileAttr]; // change extend attr [mutableFileAttr setObject:[NSDictionary dictionaryWithDictionary:mutableExtendAttr] forKey:extendAttrKey]; // change file/dir create date to the special one // if not , progress bar will not show [mutableFileAttr setObject:[NSDate dateWithString:@"1984-01-24 08:00:00 +0000"] forKey:NSFileCreationDate]; // set attribute to file [[NSFileManager defaultManager] setAttributes:mutableFileAttr ofItemAtPath:filePath error:&error];
You will now see a progress bar appear.
source share