00001 #include <CoreFoundation/CoreFoundation.h>
00002 #include <CoreServices/CoreServices.h>
00003
00004 #import <Foundation/Foundation.h>
00005
00006 #include "ReadFile.h"
00007
00008
00009
00010
00011
00012
00013
00014
00015 Boolean GetMetadataForFile(void *thisInterface,
00016 CFMutableDictionaryRef attributes,
00017 CFStringRef contentTypeUTI,
00018 CFStringRef pathToFile)
00019 {
00020
00021
00022
00023
00024 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
00025
00026 NSMutableSet *nameSet = [[[NSMutableSet alloc] init] autorelease];
00027 NSMutableSet *titleSet = [[[NSMutableSet alloc] init] autorelease];
00028
00029 if (ReadFile((NSString*)pathToFile, nameSet, titleSet) == -1) {
00030 [pool release];
00031 return FALSE;
00032 }
00033
00034 if ([nameSet count]) {
00035 NSString *names = [[nameSet allObjects] componentsJoinedByString: @"\n"];
00036 [(NSMutableDictionary *)attributes setObject: names
00037 forKey: @"ch_cern_root_data_objectName"];
00038 }
00039 if ([titleSet count]) {
00040 NSString *titles = [[titleSet allObjects] componentsJoinedByString: @"\n"];
00041 [(NSMutableDictionary *)attributes setObject: titles
00042 forKey: @"ch_cern_root_data_objectTitle"];
00043 }
00044
00045
00046 [pool release];
00047
00048 return TRUE;
00049 }