Skip to content

Commit 8619d8f

Browse files
committed
Add host property to FullDyldCache for macOS
1 parent 5a09d8a commit 8619d8f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// FullDyldCache+host.swift
3+
// MachOKit
4+
//
5+
// Created by p-x9 on 2025/07/28
6+
//
7+
//
8+
9+
import Foundation
10+
import MachOKitC
11+
12+
extension FullDyldCache {
13+
public static var host: FullDyldCache? {
14+
#if canImport(Darwin)
15+
guard let ptr = dyld_shared_cache_file_path() else {
16+
return nil
17+
}
18+
let url: URL = .init(fileURLWithPath: .init(cString: ptr))
19+
return try? FullDyldCache(url: url)
20+
#else
21+
return nil
22+
#endif
23+
}
24+
}

0 commit comments

Comments
 (0)