Skip to content

Commit faf03e8

Browse files
authored
Merge pull request #243 from p-x9/feature/improve-subcache-loading
Improve subcache retrieval when fullCache is available
2 parents fb225e3 + 6dd616d commit faf03e8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Sources/MachOKit/Model/DyldCache/DyldSubCacheEntry.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ public enum DyldSubCacheEntry: Sendable {
6363
// cache
6464
extension DyldSubCacheEntry {
6565
public func subcache(for cache: DyldCache) throws -> DyldCache? {
66+
if let _fullCache = cache._fullCache {
67+
return _fullCache.subCaches.first(
68+
where: {
69+
$0.url.lastPathComponent.hasSuffix(fileSuffix)
70+
}
71+
)
72+
}
6673
let url = URL(fileURLWithPath: cache.url.path + fileSuffix)
6774
let subcache = try DyldCache(subcacheUrl: url, mainCache: cache)
6875
subcache._fullCache = cache._fullCache

0 commit comments

Comments
 (0)