Skip to content

Commit

Permalink
Bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
tinymind committed Aug 15, 2016
1 parent 34a0562 commit aa20de3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
19 changes: 15 additions & 4 deletions LSUnusedResources/Model/ResourceStringSearcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,15 @@ - (void)reset {
}

- (BOOL)containsResourceName:(NSString *)name {
return [self.resStringSet containsObject:name];
if ([self.resStringSet containsObject:name]) {
return YES;
} else {
if ([name pathExtension]) {
NSString *nameWithoutSuffix = [StringUtils stringByRemoveResourceSuffix:name];
return [self.resStringSet containsObject:nameWithoutSuffix];
}
}
return NO;
}

- (BOOL)containsSimilarResourceName:(NSString *)name {
Expand Down Expand Up @@ -181,7 +189,7 @@ - (void)parseFileAtPath:(NSString *)path withType:(LSFileType)fileType {
groupIndex = 1;
break;
case LSFileTypeSwift:
pattern = @"named:\\s*\"(.+?)\"";//UIImage(named:"xx") or UIImage(named: "xx")
pattern = @"\"(.+?)\"";//@"named:\\s*\"(.+?)\"";//UIImage(named:"xx") or UIImage(named: "xx")
groupIndex = 1;
break;
case LSFileTypeXib:
Expand All @@ -196,8 +204,11 @@ - (void)parseFileAtPath:(NSString *)path withType:(LSFileType)fileType {
pattern = @":\\s+\"(.+?)\"";//"xx"
groupIndex = 1;
break;
case LSFileTypeCSS:
case LSFileTypePlist:
pattern = @">(.+?)<";//"<string>xx</string>"
groupIndex = 1;
break;
case LSFileTypeCSS:
case LSFileTypeH:
case LSFileTypeC:
pattern = [NSString stringWithFormat:@"([a-zA-Z0-9_-]+)\\.(%@)", self.resSuffixs.count ? [self.resSuffixs componentsJoinedByString:@"|"] : @"png|gif|jpg|jpeg"]; //*.(png|gif|jpg|jpeg)
Expand All @@ -222,7 +233,7 @@ - (NSArray *)getMatchStringWithContent:(NSString *)content pattern:(NSString*)pa
for (NSTextCheckingResult *checkingResult in matchs) {
NSString *res = [content substringWithRange:[checkingResult rangeAtIndex:index]];
res = [res lastPathComponent];
res = [StringUtils stringByRemoveResourceSuffix:res];
// res = [StringUtils stringByRemoveResourceSuffix:res];
[list addObject:res];
}
return list;
Expand Down
6 changes: 3 additions & 3 deletions LSUnusedResources/Recourse/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15E65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" initialViewController="B8D-0N-5wS">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15E65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" initialViewController="B8D-0N-5wS">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
</dependencies>
<scenes>
<!--Application-->
Expand Down Expand Up @@ -842,7 +842,7 @@
<button id="S3o-93-b4F">
<rect key="frame" x="320" y="65" width="106" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title=".swift" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="eMo-a6-OLG">
<buttonCell key="cell" type="check" title=".swift" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="eMo-a6-OLG">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
Expand Down
Binary file modified Release/LSUnusedResources.app.zip
Binary file not shown.

0 comments on commit aa20de3

Please sign in to comment.