Skip to content

Commit ec44af8

Browse files
committed
Restore delete behavior to fix tests
1 parent c5127ee commit ec44af8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/XcodesKit/RuntimeInstaller.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,25 @@ public class RuntimeInstaller {
9999
public func downloadAndInstallRuntime(identifier: String, to destinationDirectory: Path, with downloader: Downloader, shouldDelete: Bool) async throws {
100100
let matchedRuntime = try await getMatchingRuntime(identifier: identifier)
101101

102+
let deleteIfNeeded: (URL) -> Void = { dmgUrl in
103+
if shouldDelete {
104+
Current.logging.log("Deleting Archive")
105+
try? Current.files.removeItem(at: dmgUrl)
106+
}
107+
}
108+
102109
switch matchedRuntime.contentType {
103110
case .package:
104111
guard Current.shell.isRoot() else {
105112
throw Error.rootNeeded
106113
}
107114
let dmgUrl = try await downloadOrUseExistingArchive(runtime: matchedRuntime, to: destinationDirectory, downloader: downloader)
108115
try await installFromPackage(dmgUrl: dmgUrl, runtime: matchedRuntime)
116+
deleteIfNeeded(dmgUrl)
109117
case .diskImage:
110118
let dmgUrl = try await downloadOrUseExistingArchive(runtime: matchedRuntime, to: destinationDirectory, downloader: downloader)
111119
try await installFromImage(dmgUrl: dmgUrl)
120+
deleteIfNeeded(dmgUrl)
112121
case .cryptexDiskImage:
113122
try await downloadAndInstallUsingXcodeBuild(runtime: matchedRuntime)
114123
}

0 commit comments

Comments
 (0)