Skip to content

Commit 5789cca

Browse files
committed
Rename patchImagePathForDYLD to patchImagePathForDyld, only patch /
1 parent 0b12ded commit 5789cca

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

HeaderViewer/RuntimeListings.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ final class RuntimeListings: ObservableObject {
4949
}
5050

5151
func isImageLoaded(path: String) -> Bool {
52-
imageList.contains(CDUtilities.patchImagePathForDYLD(path))
52+
imageList.contains(CDUtilities.patchImagePathForDyld(path))
5353
}
5454
}
5555

@@ -75,7 +75,7 @@ extension CDUtilities {
7575
}
7676

7777
class func classNamesIn(image: String) -> [String] {
78-
patchImagePathForDYLD(image).withCString(encodedAs: Unicode.UTF8.self) { cString in
78+
patchImagePathForDyld(image).withCString { cString in
7979
var classCount: UInt32 = 0
8080
guard let classNames = objc_copyClassNamesForImage(cString, &classCount) else { return [] }
8181

@@ -91,7 +91,8 @@ extension CDUtilities {
9191
}
9292

9393
extension CDUtilities {
94-
class func patchImagePathForDYLD(_ imagePath: String) -> String {
94+
class func patchImagePathForDyld(_ imagePath: String) -> String {
95+
guard imagePath.starts(with: "/") else { return imagePath }
9596
let rootPath = ProcessInfo.processInfo.environment["DYLD_ROOT_PATH"]
9697
guard let rootPath else { return imagePath }
9798
return rootPath.appending(imagePath)

0 commit comments

Comments
 (0)