Skip to content

Commit

Permalink
Remove all extensions when parsing a framework name from its path
Browse files Browse the repository at this point in the history
  • Loading branch information
aricha committed Jan 6, 2014
1 parent ddc7ec6 commit 1e70fe5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Source/CDFile.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@

NSString *CDImportNameForPath(NSString *path)
{
NSString *name = [[path lastPathComponent] stringByDeletingPathExtension];
NSString *name = [path lastPathComponent];

// Remove all extensions (make sure extensions like .a.dylib are covered)
NSString *nameWithExtensions = name;
for (NSInteger i = ([nameWithExtensions length] - 1); i >= 0; i--) {
if ([nameWithExtensions characterAtIndex:i] == '.')
name = [name substringToIndex:i];
}

NSString *libPrefix = @"lib";
if ([name hasPrefix:libPrefix])
name = [name substringFromIndex:[libPrefix length]];
Expand Down

0 comments on commit 1e70fe5

Please sign in to comment.