StikDebug/StikJIT/Utilities/Extensions.swift
Huge_Black 09775023aa
Fix pip & url scheme (#231)
* Add URL Scheme for custom app scripts

* add PID and fix script base64

* Fix pip & url scheme

---------

Co-authored-by: Stossy11 <69031796+stossy11@users.noreply.github.com>
2025-07-16 08:26:38 -04:00

26 lines
1.1 KiB
Swift

//
// Extensions.swift
// StikDebug
//
// Created by s s on 2025/7/9.
//
import UniformTypeIdentifiers
extension FileManager {
func filePath(atPath path: String, withLength length: Int) -> String? {
guard let file = try? contentsOfDirectory(atPath: path).filter({ $0.count == length }).first else { return nil }
return "\(path)/\(file)"
}
}
public extension ProcessInfo {
var hasTXM: Bool {
{ if let boot = FileManager.default.filePath(atPath: "/System/Volumes/Preboot", withLength: 36), let file = FileManager.default.filePath(atPath: "\(boot)/boot", withLength: 96) { return access("\(file)/usr/standalone/firmware/FUD/Ap,TrustedExecutionMonitor.img4", F_OK) == 0 } else { return (FileManager.default.filePath(atPath: "/private/preboot", withLength: 96).map { access("\($0)/usr/standalone/firmware/FUD/Ap,TrustedExecutionMonitor.img4", F_OK) == 0 }) ?? false } }()
}
}
extension UIDocumentPickerViewController {
@objc func fix_init(forOpeningContentTypes contentTypes: [UTType], asCopy: Bool) -> UIDocumentPickerViewController {
return fix_init(forOpeningContentTypes: contentTypes, asCopy: true)
}
}