(context, identity)
| 677 | } |
| 678 | |
| 679 | function readCachedXcodeContext(context, identity) { |
| 680 | const cachePath = xcodeContextCachePath(context); |
| 681 | if (!fs.existsSync(cachePath)) { |
| 682 | return null; |
| 683 | } |
| 684 | try { |
| 685 | const cached = JSON.parse(fs.readFileSync(cachePath, "utf8")); |
| 686 | if (JSON.stringify(cached.identity) !== JSON.stringify(identity)) { |
| 687 | return null; |
| 688 | } |
| 689 | const xcode = cached.xcode; |
| 690 | if (!xcode?.appPath || !fs.existsSync(xcode.appPath)) { |
| 691 | return null; |
| 692 | } |
| 693 | if (xcode.debugDylibPath && !fs.existsSync(xcode.debugDylibPath)) { |
| 694 | return null; |
| 695 | } |
| 696 | return xcode; |
| 697 | } catch { |
| 698 | return null; |
| 699 | } |
| 700 | } |
| 701 | |
| 702 | function writeCachedXcodeContext(context, identity, xcode) { |
| 703 | fs.writeFileSync( |
no test coverage detected