From e5d66defbc17cec8534ac603a1188d98b3668843 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Wed, 13 Apr 2022 20:41:38 -0700 Subject: [PATCH] =?UTF-8?q?#ifdef=E2=80=99s=20out=20libfragmentzip=20and?= =?UTF-8?q?=20AppleArchive=20usage=20for=20simulator=20builds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Neither are supported by the iOS simulator. --- .../Operations/Patch App/PatchAppOperation.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/AltStore/Operations/Patch App/PatchAppOperation.swift b/AltStore/Operations/Patch App/PatchAppOperation.swift index 1539d3e8..af724e1e 100644 --- a/AltStore/Operations/Patch App/PatchAppOperation.swift +++ b/AltStore/Operations/Patch App/PatchAppOperation.swift @@ -158,6 +158,10 @@ private extension PatchAppOperation func downloadArchive(from update: OTAUpdate) -> AnyPublisher { Just(()).tryMap { + #if targetEnvironment(simulator) + throw PatchAppError.unsupportedOperatingSystemVersion(ProcessInfo.processInfo.operatingSystemVersion) + #else + try FileManager.default.createDirectory(at: self.patchDirectory, withIntermediateDirectories: true, attributes: nil) let archiveURL = self.patchDirectory.appendingPathComponent("ota.archive") @@ -179,6 +183,8 @@ private extension PatchAppOperation print("Downloaded OTA archive.") return archiveURL + + #endif } .mapError { ($0 as NSError).withLocalizedFailure(NSLocalizedString("Could not download OTA archive.", comment: "")) } .eraseToAnyPublisher() @@ -187,6 +193,10 @@ private extension PatchAppOperation func extractSpotlightFromArchive(at archiveURL: URL) -> AnyPublisher { Just(()).tryMap { + #if targetEnvironment(simulator) + throw PatchAppError.unsupportedOperatingSystemVersion(ProcessInfo.processInfo.operatingSystemVersion) + #else + let spotlightPath = "Applications/Spotlight.app/Spotlight" let spotlightFileURL = self.patchDirectory.appendingPathComponent(spotlightPath) @@ -203,6 +213,8 @@ private extension PatchAppOperation print("Extracted Spotlight from OTA archive.") return spotlightFileURL + + #endif } .mapError { ($0 as NSError).withLocalizedFailure(NSLocalizedString("Could not extract Spotlight from OTA archive.", comment: "")) } .eraseToAnyPublisher()