├── graph_detail.png ├── UTIsExplorer ├── UTIsExplorer-Prefix.pch ├── main.m └── UTIsExplorer.1 ├── UTIsExplorer.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── nst.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── xcuserdata │ └── nst.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── UTIsExplorer.xcscheme └── project.pbxproj ├── .gitignore ├── README.md ├── UTIsExplorer.h ├── SystemDeclaredUTIs.plist └── UTIsExplorer.m /graph_detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nst/UTIsExplorer/master/graph_detail.png -------------------------------------------------------------------------------- /UTIsExplorer/UTIsExplorer-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'UTIsExplorer' target in the 'UTIsExplorer' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /UTIsExplorer.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /UTIsExplorer.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nst/UTIsExplorer/master/UTIsExplorer.xcodeproj/project.xcworkspace/xcuserdata/nst.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | build/* 3 | *.pbxuser 4 | !default.pbxuser 5 | *.mode1v3 6 | !default.mode1v3 7 | *.mode2v3 8 | !default.mode2v3 9 | *.perspectivev3 10 | !default.perspectivev3 11 | *.xcworkspace 12 | !default.xcworkspace 13 | xcuserdata 14 | profile 15 | *.moved-aside 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [http://seriot.ch/resources/utis_graph/utis_graph.dot](http://seriot.ch/resources/utis_graph/utis_graph.dot) 2 | 3 | [http://seriot.ch/resources/utis_graph/utis_graph.pdf](http://seriot.ch/resources/utis_graph/utis_graph.pdf) 4 | 5 | ![UTIs graph](https://github.com/nst/UTIsExplorer/raw/master/graph_detail.png) 6 | -------------------------------------------------------------------------------- /UTIsExplorer.h: -------------------------------------------------------------------------------- 1 | // 2 | // UTIsExplorer.h 3 | // SpotLook 4 | // 5 | // Created by Nicolas Seriot on 3/2/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UTIsExplorer : NSObject { 12 | NSMutableDictionary *parentsForUTIs; 13 | } 14 | 15 | - (void)lookForUTIs:(void (^) (NSArray *UTIs))successBlock; 16 | 17 | - (NSString *)graphvizDescription; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /UTIsExplorer.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | UTIsExplorer.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 034C8A2A1502A42200FD7204 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /UTIsExplorer/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // UTIsExplorer 4 | // 5 | // Created by Nicolas Seriot on 3/3/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UTIsExplorer.h" 11 | 12 | int main(int argc, const char * argv[]) 13 | { 14 | 15 | @autoreleasepool { 16 | 17 | [NSApplication sharedApplication]; 18 | 19 | UTIsExplorer *utisExplorer = [[UTIsExplorer alloc] init]; 20 | 21 | [utisExplorer lookForUTIs:^(NSArray *UTIs) { 22 | //NSLog(@"-- UTIs %@", UTIs); 23 | 24 | NSString *s = [utisExplorer graphvizDescription]; 25 | 26 | NSString * const graphFileName = @"utis_graph"; 27 | NSString * const graphFileExtension = @"dot"; 28 | NSString *path = [[[[NSBundle mainBundle] bundlePath] 29 | stringByAppendingPathComponent:graphFileName] 30 | stringByAppendingPathExtension:graphFileExtension]; 31 | 32 | NSError *error = nil; 33 | BOOL success = [s writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:&error]; 34 | if(success) { 35 | NSLog(@"-- wrote file %@", path); 36 | } else { 37 | NSLog(@"-- error: %@", error); 38 | } 39 | 40 | [[NSApplication sharedApplication] terminate:nil]; 41 | 42 | }]; 43 | 44 | [utisExplorer release]; 45 | 46 | [NSApp run]; 47 | } 48 | return 0; 49 | } 50 | 51 | -------------------------------------------------------------------------------- /UTIsExplorer/UTIsExplorer.1: -------------------------------------------------------------------------------- 1 | .\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. 2 | .\"See Also: 3 | .\"man mdoc.samples for a complete listing of options 4 | .\"man mdoc for the short list of editing options 5 | .\"/usr/share/misc/mdoc.template 6 | .Dd 3/3/12 \" DATE 7 | .Dt UTIsExplorer 1 \" Program name and manual section number 8 | .Os Darwin 9 | .Sh NAME \" Section Header - required - don't modify 10 | .Nm UTIsExplorer, 11 | .\" The following lines are read in generating the apropos(man -k) database. Use only key 12 | .\" words here as the database is built based on the words here and in the .ND line. 13 | .Nm Other_name_for_same_program(), 14 | .Nm Yet another name for the same program. 15 | .\" Use .Nm macro to designate other names for the documented program. 16 | .Nd This line parsed for whatis database. 17 | .Sh SYNOPSIS \" Section Header - required - don't modify 18 | .Nm 19 | .Op Fl abcd \" [-abcd] 20 | .Op Fl a Ar path \" [-a path] 21 | .Op Ar file \" [file] 22 | .Op Ar \" [file ...] 23 | .Ar arg0 \" Underlined argument - use .Ar anywhere to underline 24 | arg2 ... \" Arguments 25 | .Sh DESCRIPTION \" Section Header - required - don't modify 26 | Use the .Nm macro to refer to your program throughout the man page like such: 27 | .Nm 28 | Underlining is accomplished with the .Ar macro like this: 29 | .Ar underlined text . 30 | .Pp \" Inserts a space 31 | A list of items with descriptions: 32 | .Bl -tag -width -indent \" Begins a tagged list 33 | .It item a \" Each item preceded by .It macro 34 | Description of item a 35 | .It item b 36 | Description of item b 37 | .El \" Ends the list 38 | .Pp 39 | A list of flags and their descriptions: 40 | .Bl -tag -width -indent \" Differs from above in tag removed 41 | .It Fl a \"-a flag as a list item 42 | Description of -a flag 43 | .It Fl b 44 | Description of -b flag 45 | .El \" Ends the list 46 | .Pp 47 | .\" .Sh ENVIRONMENT \" May not be needed 48 | .\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 49 | .\" .It Ev ENV_VAR_1 50 | .\" Description of ENV_VAR_1 51 | .\" .It Ev ENV_VAR_2 52 | .\" Description of ENV_VAR_2 53 | .\" .El 54 | .Sh FILES \" File used or created by the topic of the man page 55 | .Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact 56 | .It Pa /usr/share/file_name 57 | FILE_1 description 58 | .It Pa /Users/joeuser/Library/really_long_file_name 59 | FILE_2 description 60 | .El \" Ends the list 61 | .\" .Sh DIAGNOSTICS \" May not be needed 62 | .\" .Bl -diag 63 | .\" .It Diagnostic Tag 64 | .\" Diagnostic informtion here. 65 | .\" .It Diagnostic Tag 66 | .\" Diagnostic informtion here. 67 | .\" .El 68 | .Sh SEE ALSO 69 | .\" List links in ascending order by section, alphabetically within a section. 70 | .\" Please do not reference files that do not exist without filing a bug report 71 | .Xr a 1 , 72 | .Xr b 1 , 73 | .Xr c 1 , 74 | .Xr a 2 , 75 | .Xr b 2 , 76 | .Xr a 3 , 77 | .Xr b 3 78 | .\" .Sh BUGS \" Document known, unremedied bugs 79 | .\" .Sh HISTORY \" Document history if command behaves in a unique manner -------------------------------------------------------------------------------- /UTIsExplorer.xcodeproj/xcuserdata/nst.xcuserdatad/xcschemes/UTIsExplorer.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 38 | 39 | 40 | 41 | 50 | 51 | 57 | 58 | 59 | 60 | 61 | 62 | 68 | 69 | 75 | 76 | 77 | 78 | 80 | 81 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /SystemDeclaredUTIs.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | public.item 6 | public.content 7 | public.composite-content 8 | public.data 9 | public.database 10 | public.calendar-event 11 | public.message 12 | public.presentation 13 | public.contact 14 | public.archive 15 | public.disk-image 16 | public.text 17 | public.plain-text 18 | public.utf8-plain-text 19 | public.utf16-external-plain-​text 20 | public.utf16-plain-text 21 | com.apple.traditional-mac-​plain-text 22 | public.rtf 23 | com.apple.ink.inktext 24 | public.html 25 | public.xml 26 | public.source-code 27 | public.c-source 28 | public.objective-c-source 29 | public.c-plus-plus-source 30 | public.objective-c-plus-​plus-source 31 | public.c-header 32 | public.c-plus-plus-header 33 | com.sun.java-source 34 | public.script 35 | public.assembly-source 36 | com.apple.rez-source 37 | public.mig-source 38 | com.apple.symbol-export 39 | com.netscape.javascript-​source 40 | public.shell-script 41 | public.csh-script 42 | public.perl-script 43 | public.python-script 44 | public.ruby-script 45 | public.php-script 46 | com.sun.java-web-start 47 | com.apple.applescript.text 48 | com.apple.applescript.​script 49 | public.object-code 50 | com.apple.mach-o-binary 51 | com.apple.pef-binary 52 | com.microsoft.windows-​executable 53 | com.microsoft.windows-​dynamic-link-library 54 | com.sun.java-class 55 | com.sun.java-archive 56 | com.apple.quartz-​composer-composition 57 | org.gnu.gnu-tar-archive 58 | public.tar-archive 59 | org.gnu.gnu-zip-archive 60 | org.gnu.gnu-zip-tar-archive 61 | com.apple.binhex-archive 62 | com.apple.macbinary-​archive 63 | public.url 64 | public.file-url 65 | public.url-name 66 | public.vcard 67 | public.image 68 | public.fax 69 | public.jpeg 70 | public.jpeg-2000 71 | public.tiff 72 | public.camera-raw-image 73 | com.apple.pict 74 | com.apple.macpaint-image 75 | public.png 76 | public.xbitmap-image 77 | com.apple.quicktime-image 78 | com.apple.icns 79 | com.apple.txn.text-​multimedia-data 80 | public.audiovisual-​content 81 | public.movie 82 | public.video 83 | com.apple.quicktime-movie 84 | public.avi 85 | public.mpeg 86 | public.mpeg-4 87 | public.3gpp 88 | public.3gpp2 89 | public.audio 90 | public.mp3 91 | public.mpeg-4-audio 92 | com.apple.protected-​mpeg-4-audio 93 | public.ulaw-audio 94 | public.aifc-audio 95 | public.aiff-audio 96 | com.apple.coreaudio-​format 97 | public.directory 98 | public.folder 99 | public.volume 100 | com.apple.package 101 | com.apple.bundle 102 | public.executable 103 | com.apple.application 104 | com.apple.application-​bundle 105 | com.apple.application-file 106 | com.apple.deprecated-​application-file 107 | com.apple.plugin 108 | com.apple.metadata-​importer 109 | com.apple.dashboard-​widget 110 | public.cpio-archive 111 | com.pkware.zip-archive 112 | com.apple.webarchive 113 | com.apple.framework 114 | com.apple.rtfd 115 | com.apple.flat-rtfd 116 | com.apple.resolvable 117 | public.symlink 118 | com.apple.mount-point 119 | com.apple.alias-record 120 | com.apple.alias-file 121 | public.font 122 | public.truetype-font 123 | com.adobe.postscript-font 124 | com.apple.truetype-​datafork-suitcase-font 125 | public.opentype-font 126 | public.truetype-ttf-font 127 | public.truetype-collection-​font 128 | com.apple.font-suitcase 129 | com.adobe.postscript-lwfn​-font 130 | com.adobe.postscript-pfb-​font 131 | com.adobe.postscript.pfa-​font 132 | com.apple.colorsync-profile 133 | public.filename-extension 134 | public.mime-type 135 | com.apple.ostype 136 | com.apple.nspboard-type 137 | com.adobe.pdf 138 | com.adobe.postscript 139 | com.adobe.encapsulated-​postscript 140 | com.adobe.photoshop-​image 141 | com.adobe.illustrator.ai-​image 142 | com.compuserve.gif 143 | com.microsoft.bmp 144 | com.microsoft.ico 145 | com.microsoft.word.doc 146 | com.microsoft.excel.xls 147 | com.microsoft.powerpoint.​ppt 148 | com.microsoft.waveform-​audio 149 | com.microsoft.advanced-​systems-format 150 | com.microsoft.windows-​media-wm 151 | com.microsoft.windows-​media-wmv 152 | com.microsoft.windows-​media-wmp 153 | com.microsoft.windows-​media-wma 154 | com.microsoft.advanced-​stream-redirector 155 | com.microsoft.windows-​media-wmx 156 | com.microsoft.windows-​media-wvx 157 | com.microsoft.windows-​media-wax 158 | com.apple.keynote.key 159 | com.apple.keynote.kth 160 | com.truevision.tga-image 161 | com.sgi.sgi-image 162 | com.ilm.openexr-image 163 | com.kodak.flashpix.image 164 | com.j2.jfx-fax 165 | com.js.efx-fax 166 | com.digidesign.sd2-audio 167 | com.real.realmedia 168 | com.real.realaudio 169 | com.real.smil 170 | com.allume.stuffit-archive 171 | 172 | 173 | -------------------------------------------------------------------------------- /UTIsExplorer.m: -------------------------------------------------------------------------------- 1 | // 2 | // UTIsExplorer.m 3 | // SpotLook 4 | // 5 | // Created by Nicolas Seriot on 3/2/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "UTIsExplorer.h" 10 | #import 11 | 12 | @implementation UTIsExplorer 13 | 14 | - (id)init { 15 | self = [super init]; 16 | 17 | parentsForUTIs = [[NSMutableDictionary alloc] init]; 18 | 19 | return self; 20 | } 21 | 22 | - (void)dealloc { 23 | [parentsForUTIs release]; 24 | [super dealloc]; 25 | } 26 | 27 | - (void)searchForMDImporters:(void (^) (NSArray *mdImporterPaths))terminationBlock { 28 | NSMetadataQuery *query = [[NSMetadataQuery alloc] init]; 29 | query.predicate = [NSPredicate predicateWithFormat:@"kMDItemContentTypeTree == 'com.apple.metadata-importer'"]; 30 | 31 | [[NSNotificationCenter defaultCenter] addObserverForName:NSMetadataQueryDidFinishGatheringNotification object:query queue:nil usingBlock:^(NSNotification *note) { 32 | 33 | [query stopQuery]; 34 | 35 | NSOperationQueue *oq = [[[NSOperationQueue alloc] init] autorelease]; 36 | 37 | [oq addOperationWithBlock:^{ 38 | NSMutableArray *mdImporterPaths = [NSMutableArray array]; 39 | 40 | for(NSUInteger i = 0; i < [query resultCount]; i++) { 41 | 42 | NSMetadataItem *mdItem = [query resultAtIndex:i]; 43 | 44 | NSString *path = [mdItem valueForAttribute:(NSString *)kMDItemPath]; 45 | [mdImporterPaths addObject:path]; 46 | } 47 | 48 | [[NSOperationQueue mainQueue] addOperationWithBlock:^{ 49 | terminationBlock(mdImporterPaths); 50 | }]; 51 | }]; 52 | 53 | }]; 54 | 55 | [query startQuery]; 56 | } 57 | 58 | - (void)searchForApplicationsMDImporters:(void (^) (NSArray *mdImporterPaths))terminationBlock { 59 | NSMetadataQuery *query = [[NSMetadataQuery alloc] init]; 60 | query.predicate = [NSPredicate predicateWithFormat:@"kMDItemContentTypeTree == 'com.apple.application-bundle'"]; 61 | 62 | __block id observer = [[NSNotificationCenter defaultCenter] addObserverForName:NSMetadataQueryDidFinishGatheringNotification object:query queue:nil usingBlock:^(NSNotification *note) { 63 | 64 | [query stopQuery]; 65 | 66 | NSOperationQueue *oq = [[[NSOperationQueue alloc] init] autorelease]; 67 | 68 | [oq addOperationWithBlock:^{ 69 | NSFileManager *fm = [[NSFileManager alloc] init]; 70 | 71 | NSMutableArray *mdImporterPaths = [NSMutableArray array]; 72 | 73 | for(NSUInteger i = 0; i < [query resultCount]; i++) { 74 | 75 | NSMetadataItem *mdItem = [query resultAtIndex:i]; 76 | 77 | NSString *path = [mdItem valueForAttribute:(NSString *)kMDItemPath]; 78 | NSString *spotlightDirectory = [path stringByAppendingPathComponent:@"/Contents/Library/Spotlight/"]; 79 | NSArray *importers = [fm contentsOfDirectoryAtPath:spotlightDirectory error:nil]; 80 | 81 | for(NSString *name in importers) { 82 | if([[name pathExtension] isEqualToString:@"mdimporter"] == NO) continue; 83 | 84 | NSString *mdImporterPath = [spotlightDirectory stringByAppendingPathComponent:name]; 85 | 86 | [mdImporterPaths addObject:mdImporterPath]; 87 | } 88 | } 89 | 90 | [fm release]; 91 | 92 | [[NSOperationQueue mainQueue] addOperationWithBlock:^{ 93 | 94 | [[NSNotificationCenter defaultCenter] removeObserver:observer]; 95 | 96 | terminationBlock(mdImporterPaths); 97 | }]; 98 | 99 | }]; 100 | 101 | }]; 102 | 103 | [query startQuery]; 104 | } 105 | 106 | - (NSArray *)allUTIs { 107 | NSMutableSet *set = [NSMutableSet set]; 108 | 109 | [parentsForUTIs enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { 110 | NSSet *parents = (NSSet *)obj; 111 | 112 | [set addObject:key]; 113 | [set unionSet:parents]; 114 | }]; 115 | 116 | NSArray *UTIs = [set allObjects]; 117 | 118 | NSArray *sortedUTIs = [UTIs sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) { 119 | return [obj1 compare:obj2]; 120 | }]; 121 | 122 | return sortedUTIs; 123 | } 124 | 125 | - (void)readSystemDeclaredUTIs { 126 | NSString * const systemDeclaredUTIsFileName = @"SystemDeclaredUTIs"; 127 | NSString * const systemDeclaredUTIsFileExtension = @"plist"; 128 | 129 | // http://developer.apple.com/library/mac/#documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html 130 | 131 | NSString *path = [[NSBundle mainBundle] pathForResource:systemDeclaredUTIsFileName ofType:systemDeclaredUTIsFileExtension]; 132 | 133 | if(path == nil) { // may be running from command line 134 | NSString *currentDirectory = [[[NSProcessInfo processInfo] environment] valueForKey:@"PWD"]; 135 | path = [[currentDirectory stringByAppendingPathComponent:systemDeclaredUTIsFileName] stringByAppendingPathExtension:systemDeclaredUTIsFileExtension]; 136 | } 137 | 138 | NSArray *systemDeclaredUTIs = [NSArray arrayWithContentsOfFile:path]; 139 | 140 | if(systemDeclaredUTIs == nil) { 141 | NSLog(@"-- cannot find UTIs in %@", path); 142 | } 143 | 144 | for(NSString *uti in systemDeclaredUTIs) { 145 | [self addParentsForUTI:uti]; 146 | } 147 | } 148 | 149 | - (void)lookForUTIs:(void (^) (NSArray *UTIs))successBlock { 150 | 151 | [self readSystemDeclaredUTIs]; 152 | 153 | [self searchForMDImporters:^(NSArray *mdImporters) { 154 | 155 | [self searchForApplicationsMDImporters:^(NSArray *appMDImporters) { 156 | 157 | NSArray *importers = [mdImporters arrayByAddingObjectsFromArray:appMDImporters]; 158 | 159 | for(NSString *path in importers) { 160 | 161 | NSArray *UTIs = [[self class] UTISInBundleAtPath:path]; 162 | 163 | for(NSString *uti in UTIs) { 164 | [self addParentsForUTI:uti]; 165 | } 166 | 167 | } 168 | 169 | [self addAllParents]; 170 | 171 | successBlock([self allUTIs]); 172 | }]; 173 | 174 | }]; 175 | } 176 | 177 | - (void)addParentsForUTI:(NSString *)UTI { 178 | 179 | if([parentsForUTIs valueForKey:UTI] != nil) return; 180 | 181 | NSDictionary *d = (NSDictionary *)UTTypeCopyDeclaration((CFStringRef)UTI); 182 | id o = [d valueForKey:(NSString *)kUTTypeConformsToKey]; 183 | 184 | NSMutableSet *set = [NSMutableSet set]; 185 | 186 | if(o == nil) { 187 | [set addObjectsFromArray:[NSArray array]]; 188 | } else if([o isKindOfClass:[NSString class]]) { 189 | [set addObject:o]; 190 | } else if ([o isKindOfClass:[NSArray class]]) { 191 | [set addObjectsFromArray:o]; 192 | } else { 193 | NSAssert(NO, @"-- bad class: %@", o); 194 | } 195 | 196 | [d release]; 197 | 198 | [parentsForUTIs setValue:set forKey:UTI]; 199 | } 200 | 201 | - (void)addAllParents { 202 | 203 | NSMutableSet *missingParents = [NSMutableSet setWithArray:[parentsForUTIs allKeys]]; 204 | 205 | while([missingParents count] > 0) { 206 | 207 | for(NSString *p in missingParents) { 208 | [self addParentsForUTI:p]; 209 | } 210 | 211 | [missingParents removeAllObjects]; 212 | 213 | [parentsForUTIs enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { 214 | NSSet *parents = (NSSet *)obj; 215 | 216 | for(NSString *p in parents) { 217 | if([parentsForUTIs valueForKey:p] == nil) { 218 | [missingParents addObject:p]; 219 | } 220 | } 221 | }]; 222 | 223 | } 224 | } 225 | 226 | + (NSArray *)UTISInBundleAtPath:(NSString *)path { 227 | NSBundle *bundle = [NSBundle bundleWithPath:path]; 228 | NSDictionary *infoDictionary = [bundle infoDictionary]; 229 | 230 | NSDictionary *CFBundleDocumentTypes = [infoDictionary valueForKey:@"CFBundleDocumentTypes"]; 231 | NSArray *LSItemContentTypes = [CFBundleDocumentTypes valueForKey:@"LSItemContentTypes"]; 232 | 233 | if(LSItemContentTypes == nil) { 234 | return [NSArray array]; 235 | } 236 | 237 | NSAssert([LSItemContentTypes isKindOfClass:[NSArray class]], @"-- bad class: %@", [LSItemContentTypes class]); 238 | 239 | NSArray *UTIs = [LSItemContentTypes lastObject]; 240 | 241 | NSAssert([UTIs isKindOfClass:[NSArray class]], @"-- bad class: %@", [LSItemContentTypes class]); 242 | 243 | return UTIs; 244 | } 245 | 246 | - (NSString *)graphvizDescription { 247 | 248 | NSMutableString *ms = [NSMutableString stringWithString:@"digraph G {\n"]; 249 | [ms appendString:@" node [shape=box]\n"]; 250 | [ms appendString:@" graph [rankdir=LR]\n\n"]; 251 | 252 | NSArray *sortedKeys = [[parentsForUTIs allKeys] sortedArrayUsingComparator:^NSComparisonResult(NSString *s1, NSString *s2) { 253 | return [s1 compare:s2]; 254 | }]; 255 | 256 | for(NSString *key in sortedKeys) { 257 | NSSet *parents = [parentsForUTIs valueForKey:key]; 258 | 259 | for(NSString *p in parents) { 260 | [ms appendFormat:@" \"%@\" -> \"%@\"\n", key, p]; 261 | } 262 | } 263 | 264 | [ms appendString:@"}\n"]; 265 | 266 | return ms; 267 | } 268 | 269 | @end 270 | -------------------------------------------------------------------------------- /UTIsExplorer.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0332361A150496F700F3AB5F /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03323619150496F700F3AB5F /* AppKit.framework */; }; 11 | 034C8A301502A42200FD7204 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 034C8A2F1502A42200FD7204 /* Foundation.framework */; }; 12 | 034C8A331502A42200FD7204 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 034C8A321502A42200FD7204 /* main.m */; }; 13 | 034C8A371502A42200FD7204 /* UTIsExplorer.1 in Copy Files */ = {isa = PBXBuildFile; fileRef = 034C8A361502A42200FD7204 /* UTIsExplorer.1 */; }; 14 | 034C8A411502A46F00FD7204 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 034C8A401502A46F00FD7204 /* CoreServices.framework */; }; 15 | 034C8A421502A4E700FD7204 /* UTIsExplorer.m in Sources */ = {isa = PBXBuildFile; fileRef = 034C8A3F1502A46500FD7204 /* UTIsExplorer.m */; }; 16 | 03BB7BAB179D45C60007CB64 /* SystemDeclaredUTIs.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 034DA29A1517B1280066CAF3 /* SystemDeclaredUTIs.plist */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXCopyFilesBuildPhase section */ 20 | 034C8A291502A42200FD7204 /* Copy Files */ = { 21 | isa = PBXCopyFilesBuildPhase; 22 | buildActionMask = 2147483647; 23 | dstPath = /usr/share/man/man1/; 24 | dstSubfolderSpec = 0; 25 | files = ( 26 | 034C8A371502A42200FD7204 /* UTIsExplorer.1 in Copy Files */, 27 | ); 28 | name = "Copy Files"; 29 | runOnlyForDeploymentPostprocessing = 1; 30 | }; 31 | 03BB7BAA179D45AD0007CB64 /* CopyFiles */ = { 32 | isa = PBXCopyFilesBuildPhase; 33 | buildActionMask = 2147483647; 34 | dstPath = ""; 35 | dstSubfolderSpec = 16; 36 | files = ( 37 | 03BB7BAB179D45C60007CB64 /* SystemDeclaredUTIs.plist in CopyFiles */, 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXCopyFilesBuildPhase section */ 42 | 43 | /* Begin PBXFileReference section */ 44 | 03323619150496F700F3AB5F /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 45 | 034C8A2B1502A42200FD7204 /* UTIsExplorer */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = UTIsExplorer; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 034C8A2F1502A42200FD7204 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 47 | 034C8A321502A42200FD7204 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 48 | 034C8A351502A42200FD7204 /* UTIsExplorer-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UTIsExplorer-Prefix.pch"; sourceTree = ""; }; 49 | 034C8A361502A42200FD7204 /* UTIsExplorer.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = UTIsExplorer.1; sourceTree = ""; }; 50 | 034C8A3E1502A46500FD7204 /* UTIsExplorer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UTIsExplorer.h; sourceTree = ""; }; 51 | 034C8A3F1502A46500FD7204 /* UTIsExplorer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UTIsExplorer.m; sourceTree = ""; }; 52 | 034C8A401502A46F00FD7204 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; }; 53 | 034DA29A1517B1280066CAF3 /* SystemDeclaredUTIs.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = SystemDeclaredUTIs.plist; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | 034C8A281502A42200FD7204 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | 034C8A301502A42200FD7204 /* Foundation.framework in Frameworks */, 62 | 034C8A411502A46F00FD7204 /* CoreServices.framework in Frameworks */, 63 | 0332361A150496F700F3AB5F /* AppKit.framework in Frameworks */, 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | /* End PBXFrameworksBuildPhase section */ 68 | 69 | /* Begin PBXGroup section */ 70 | 034C8A201502A42100FD7204 = { 71 | isa = PBXGroup; 72 | children = ( 73 | 034C8A3E1502A46500FD7204 /* UTIsExplorer.h */, 74 | 034C8A3F1502A46500FD7204 /* UTIsExplorer.m */, 75 | 034DA29A1517B1280066CAF3 /* SystemDeclaredUTIs.plist */, 76 | 034C8A311502A42200FD7204 /* UTIsExplorer */, 77 | 034C8A2E1502A42200FD7204 /* Frameworks */, 78 | 034C8A2C1502A42200FD7204 /* Products */, 79 | ); 80 | sourceTree = ""; 81 | }; 82 | 034C8A2C1502A42200FD7204 /* Products */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 034C8A2B1502A42200FD7204 /* UTIsExplorer */, 86 | ); 87 | name = Products; 88 | sourceTree = ""; 89 | }; 90 | 034C8A2E1502A42200FD7204 /* Frameworks */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 03323619150496F700F3AB5F /* AppKit.framework */, 94 | 034C8A401502A46F00FD7204 /* CoreServices.framework */, 95 | 034C8A2F1502A42200FD7204 /* Foundation.framework */, 96 | ); 97 | name = Frameworks; 98 | sourceTree = ""; 99 | }; 100 | 034C8A311502A42200FD7204 /* UTIsExplorer */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 034C8A321502A42200FD7204 /* main.m */, 104 | 034C8A361502A42200FD7204 /* UTIsExplorer.1 */, 105 | 034C8A341502A42200FD7204 /* Supporting Files */, 106 | ); 107 | path = UTIsExplorer; 108 | sourceTree = ""; 109 | }; 110 | 034C8A341502A42200FD7204 /* Supporting Files */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 034C8A351502A42200FD7204 /* UTIsExplorer-Prefix.pch */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | /* End PBXGroup section */ 119 | 120 | /* Begin PBXNativeTarget section */ 121 | 034C8A2A1502A42200FD7204 /* UTIsExplorer */ = { 122 | isa = PBXNativeTarget; 123 | buildConfigurationList = 034C8A3A1502A42200FD7204 /* Build configuration list for PBXNativeTarget "UTIsExplorer" */; 124 | buildPhases = ( 125 | 034C8A271502A42200FD7204 /* Sources */, 126 | 034C8A281502A42200FD7204 /* Frameworks */, 127 | 034C8A291502A42200FD7204 /* Copy Files */, 128 | 03BB7BAA179D45AD0007CB64 /* CopyFiles */, 129 | ); 130 | buildRules = ( 131 | ); 132 | dependencies = ( 133 | ); 134 | name = UTIsExplorer; 135 | productName = UTIsExplorer; 136 | productReference = 034C8A2B1502A42200FD7204 /* UTIsExplorer */; 137 | productType = "com.apple.product-type.tool"; 138 | }; 139 | /* End PBXNativeTarget section */ 140 | 141 | /* Begin PBXProject section */ 142 | 034C8A221502A42100FD7204 /* Project object */ = { 143 | isa = PBXProject; 144 | attributes = { 145 | LastUpgradeCheck = 0460; 146 | }; 147 | buildConfigurationList = 034C8A251502A42100FD7204 /* Build configuration list for PBXProject "UTIsExplorer" */; 148 | compatibilityVersion = "Xcode 3.2"; 149 | developmentRegion = English; 150 | hasScannedForEncodings = 0; 151 | knownRegions = ( 152 | en, 153 | ); 154 | mainGroup = 034C8A201502A42100FD7204; 155 | productRefGroup = 034C8A2C1502A42200FD7204 /* Products */; 156 | projectDirPath = ""; 157 | projectRoot = ""; 158 | targets = ( 159 | 034C8A2A1502A42200FD7204 /* UTIsExplorer */, 160 | ); 161 | }; 162 | /* End PBXProject section */ 163 | 164 | /* Begin PBXSourcesBuildPhase section */ 165 | 034C8A271502A42200FD7204 /* Sources */ = { 166 | isa = PBXSourcesBuildPhase; 167 | buildActionMask = 2147483647; 168 | files = ( 169 | 034C8A331502A42200FD7204 /* main.m in Sources */, 170 | 034C8A421502A4E700FD7204 /* UTIsExplorer.m in Sources */, 171 | ); 172 | runOnlyForDeploymentPostprocessing = 0; 173 | }; 174 | /* End PBXSourcesBuildPhase section */ 175 | 176 | /* Begin XCBuildConfiguration section */ 177 | 034C8A381502A42200FD7204 /* Debug */ = { 178 | isa = XCBuildConfiguration; 179 | buildSettings = { 180 | ALWAYS_SEARCH_USER_PATHS = NO; 181 | ARCHS = "$(ARCHS_STANDARD_64_BIT)"; 182 | CLANG_WARN_CONSTANT_CONVERSION = YES; 183 | CLANG_WARN_ENUM_CONVERSION = YES; 184 | CLANG_WARN_INT_CONVERSION = YES; 185 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 186 | COPY_PHASE_STRIP = NO; 187 | GCC_C_LANGUAGE_STANDARD = gnu99; 188 | GCC_DYNAMIC_NO_PIC = NO; 189 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 190 | GCC_OPTIMIZATION_LEVEL = 0; 191 | GCC_PREPROCESSOR_DEFINITIONS = ( 192 | "DEBUG=1", 193 | "$(inherited)", 194 | ); 195 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 196 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 197 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 198 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 199 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 200 | GCC_WARN_UNUSED_VARIABLE = YES; 201 | MACOSX_DEPLOYMENT_TARGET = 10.7; 202 | ONLY_ACTIVE_ARCH = YES; 203 | SDKROOT = macosx; 204 | }; 205 | name = Debug; 206 | }; 207 | 034C8A391502A42200FD7204 /* Release */ = { 208 | isa = XCBuildConfiguration; 209 | buildSettings = { 210 | ALWAYS_SEARCH_USER_PATHS = NO; 211 | ARCHS = "$(ARCHS_STANDARD_64_BIT)"; 212 | CLANG_WARN_CONSTANT_CONVERSION = YES; 213 | CLANG_WARN_ENUM_CONVERSION = YES; 214 | CLANG_WARN_INT_CONVERSION = YES; 215 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 216 | COPY_PHASE_STRIP = YES; 217 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 218 | GCC_C_LANGUAGE_STANDARD = gnu99; 219 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 220 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 221 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 222 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 223 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 224 | GCC_WARN_UNUSED_VARIABLE = YES; 225 | MACOSX_DEPLOYMENT_TARGET = 10.7; 226 | SDKROOT = macosx; 227 | }; 228 | name = Release; 229 | }; 230 | 034C8A3B1502A42200FD7204 /* Debug */ = { 231 | isa = XCBuildConfiguration; 232 | buildSettings = { 233 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 234 | GCC_PREFIX_HEADER = "UTIsExplorer/UTIsExplorer-Prefix.pch"; 235 | PRODUCT_NAME = "$(TARGET_NAME)"; 236 | }; 237 | name = Debug; 238 | }; 239 | 034C8A3C1502A42200FD7204 /* Release */ = { 240 | isa = XCBuildConfiguration; 241 | buildSettings = { 242 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 243 | GCC_PREFIX_HEADER = "UTIsExplorer/UTIsExplorer-Prefix.pch"; 244 | PRODUCT_NAME = "$(TARGET_NAME)"; 245 | }; 246 | name = Release; 247 | }; 248 | /* End XCBuildConfiguration section */ 249 | 250 | /* Begin XCConfigurationList section */ 251 | 034C8A251502A42100FD7204 /* Build configuration list for PBXProject "UTIsExplorer" */ = { 252 | isa = XCConfigurationList; 253 | buildConfigurations = ( 254 | 034C8A381502A42200FD7204 /* Debug */, 255 | 034C8A391502A42200FD7204 /* Release */, 256 | ); 257 | defaultConfigurationIsVisible = 0; 258 | defaultConfigurationName = Release; 259 | }; 260 | 034C8A3A1502A42200FD7204 /* Build configuration list for PBXNativeTarget "UTIsExplorer" */ = { 261 | isa = XCConfigurationList; 262 | buildConfigurations = ( 263 | 034C8A3B1502A42200FD7204 /* Debug */, 264 | 034C8A3C1502A42200FD7204 /* Release */, 265 | ); 266 | defaultConfigurationIsVisible = 0; 267 | defaultConfigurationName = Release; 268 | }; 269 | /* End XCConfigurationList section */ 270 | }; 271 | rootObject = 034C8A221502A42100FD7204 /* Project object */; 272 | } 273 | --------------------------------------------------------------------------------