Hopefully fix issue #330

This commit is contained in:
Stephen 2026-05-18 09:38:57 -04:00
parent 08830f1125
commit a4ce84cdd4
3 changed files with 48 additions and 3 deletions

View file

@ -568,7 +568,15 @@
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = SZ977XLF24;
GENERATE_INFOPLIST_FILE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/StikJIT/idevice",
);
IPHONEOS_DEPLOYMENT_TARGET = 18.2;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/StikJIT/idevice",
);
MACOSX_DEPLOYMENT_TARGET = 15.1;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.stik.StikJITTests;
@ -576,6 +584,7 @@
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_INCLUDE_PATHS = "$(inherited) $(PROJECT_DIR)/StikJIT/idevice";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,7";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StikDebug.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/StikDebug";
@ -591,7 +600,15 @@
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = SZ977XLF24;
GENERATE_INFOPLIST_FILE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/StikJIT/idevice",
);
IPHONEOS_DEPLOYMENT_TARGET = 18.2;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/StikJIT/idevice",
);
MACOSX_DEPLOYMENT_TARGET = 15.1;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.stik.StikJITTests;
@ -599,6 +616,7 @@
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_INCLUDE_PATHS = "$(inherited) $(PROJECT_DIR)/StikJIT/idevice";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,7";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StikDebug.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/StikDebug";

View file

@ -411,13 +411,26 @@ public extension ProcessInfo {
if isTXMOverridden {
return true
}
return ProcessInfo.detectLocalTXM()
return ProcessInfo.hasTXMSupport(
operatingSystemVersion: operatingSystemVersion,
localTXMDetector: ProcessInfo.detectLocalTXM
)
}
var isTXMOverridden: Bool {
UserDefaults.standard.bool(forKey: UserDefaults.Keys.txmOverride)
}
static func hasTXMSupport(
operatingSystemVersion: OperatingSystemVersion,
localTXMDetector: () -> Bool
) -> Bool {
guard operatingSystemVersion.majorVersion >= 26 else {
return false
}
return localTXMDetector()
}
private static func detectLocalTXM() -> Bool {
if let boot = FileManager.default.filePath(atPath: "/System/Volumes/Preboot", withLength: 36),
let file = FileManager.default.filePath(atPath: "\(boot)/boot", withLength: 96) {

View file

@ -5,12 +5,26 @@
// Created by Stephen on 3/26/25.
//
import Foundation
import Testing
@testable import StikDebug
struct StikJITTests {
@Test func example() async throws {
// Write your test here and use APIs like `#expect(...)` to check expected conditions.
@Test func txmDetectionIgnoresFirmwareFileBeforeIOS26() async throws {
let isSupported = ProcessInfo.hasTXMSupport(
operatingSystemVersion: OperatingSystemVersion(majorVersion: 18, minorVersion: 7, patchVersion: 2),
localTXMDetector: { true }
)
#expect(isSupported == false)
}
@Test func txmDetectionRequiresLocalTXMOnIOS26() async throws {
let iOS26 = OperatingSystemVersion(majorVersion: 26, minorVersion: 0, patchVersion: 0)
#expect(ProcessInfo.hasTXMSupport(operatingSystemVersion: iOS26, localTXMDetector: { false }) == false)
#expect(ProcessInfo.hasTXMSupport(operatingSystemVersion: iOS26, localTXMDetector: { true }) == true)
}
}