@@ -36,32 +36,44 @@ extension InjectorV3 {
3636
3737 // MARK: - Shared Methods
3838
39- func frameworkMachOsInBundle ( _ target: URL ) throws -> OrderedSet < URL > {
39+ func allFrameworkMachOsInBundle ( _ target: URL ) -> OrderedSet < URL > {
4040 precondition ( checkIsBundle ( target) , " Not a bundle: \( target. path) " )
4141
42- let executableURL = try locateExecutableInBundle ( target)
43- precondition ( isMachO ( executableURL) , " Not a Mach-O: \( executableURL. path) " )
44-
4542 let frameworksURL = target. appendingPathComponent ( " Frameworks " )
46- let linkedDylibs = try linkedDylibsRecursivelyOfMachO ( executableURL)
4743
4844 var enumeratedURLs = OrderedSet < URL > ( )
4945 if let enumerator = FileManager . default. enumerator (
5046 at: frameworksURL,
51- includingPropertiesForKeys: [ . fileSizeKey ] ,
47+ includingPropertiesForKeys: [ . isRegularFileKey ] ,
5248 options: [ . skipsHiddenFiles]
5349 ) {
5450 for case let itemURL as URL in enumerator {
5551 if checkIsInjectedBundle ( itemURL) || enumerator. level > 2 {
5652 enumerator. skipDescendants ( )
5753 continue
5854 }
59- if enumerator. level == 2 {
55+ if enumerator. level == 2 ,
56+ isMachO ( itemURL) ,
57+ !itemURL. lastPathComponent. hasSuffix ( " . \( Self . injectedMarkerName) .bak " ) ,
58+ !itemURL. lastPathComponent. hasSuffix ( " .troll-fools.bak " )
59+ {
6060 enumeratedURLs. append ( itemURL)
6161 }
6262 }
6363 }
6464
65+ return enumeratedURLs
66+ }
67+
68+ func frameworkMachOsInBundle( _ target: URL ) throws -> OrderedSet < URL > {
69+ precondition ( checkIsBundle ( target) , " Not a bundle: \( target. path) " )
70+
71+ let executableURL = try locateExecutableInBundle ( target)
72+ precondition ( isMachO ( executableURL) , " Not a Mach-O: \( executableURL. path) " )
73+
74+ let linkedDylibs = try linkedDylibsRecursivelyOfMachO ( executableURL)
75+ let enumeratedURLs = allFrameworkMachOsInBundle ( target)
76+
6577 let machOs = linkedDylibs. intersection ( enumeratedURLs)
6678 var sortedMachOs : [ URL ] =
6779 switch injectStrategy {
0 commit comments