@@ -356,12 +356,6 @@ int main(int argc, char *argv[])
356
356
fprintf (stderr, " Error: %s \n " , [[error localizedFailureReason ] UTF8String ]);
357
357
exit (1 );
358
358
} else {
359
- if (dumpEnt) {
360
- NSString *ent = [[classDump.machOFiles firstObject ] entitlements ];
361
- DLog (@" %@ " , ent);
362
- exit (0 );
363
- // NSString *ent = [classDump.machOFiles]
364
- }
365
359
[classDump processObjectiveCData ];
366
360
[classDump registerTypes ];
367
361
@@ -376,6 +370,15 @@ int main(int argc, char *argv[])
376
370
classDump.typeController .delegate = multiFileVisitor;
377
371
multiFileVisitor.outputPath = outputPath;
378
372
[classDump recursivelyVisit: multiFileVisitor];
373
+ if (dumpEnt) {
374
+ NSString *newName = [[[[executablePath lastPathComponent ] stringByDeletingPathExtension ] stringByAppendingString: @" -Entitlements" ] stringByAppendingPathExtension: @" plist" ];
375
+ NSString *entPath = [outputPath stringByAppendingPathComponent: newName];
376
+ NSDictionary *ent = [[classDump.machOFiles firstObject ] entitlementsDictionary ];
377
+ if (ent){
378
+ InfoLog (@" writing entitlements to path: %@ " , entPath);
379
+ [ent writeToFile: entPath atomically: true ];
380
+ }
381
+ }
379
382
} else {
380
383
if (suppressAllHeaderOutput){
381
384
exit (0 );
@@ -385,6 +388,10 @@ int main(int argc, char *argv[])
385
388
if ([hiddenSections containsObject: @" structures" ]) visitor.shouldShowStructureSection = NO ;
386
389
if ([hiddenSections containsObject: @" protocols" ]) visitor.shouldShowProtocolSection = NO ;
387
390
[classDump recursivelyVisit: visitor];
391
+ if (dumpEnt) {
392
+ NSString *ent = [[classDump.machOFiles firstObject ] entitlements ];
393
+ DLog (@" %@ " , ent);
394
+ }
388
395
}
389
396
}
390
397
}
0 commit comments