Skip to content

Commit e1add94

Browse files
committed
Delete BuildManifest.plist after using (#458)
1 parent 578237a commit e1add94

File tree

1 file changed

+13
-2
lines changed
  • src/main/java/airsquared/blobsaver/app

1 file changed

+13
-2
lines changed

src/main/java/airsquared/blobsaver/app/TSS.java

+13-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.net.URISyntaxException;
3030
import java.net.URL;
3131
import java.net.http.HttpResponse;
32+
import java.nio.file.Files;
3233
import java.nio.file.Path;
3334
import java.util.ArrayList;
3435
import java.util.Collections;
@@ -135,8 +136,10 @@ protected String call() throws TSSException {
135136

136137
private void saveFor(Utils.IOSVersion iosVersion, ArrayList<String> args) throws TSSException {
137138
final int urlIndex = args.size() - 1;
139+
Path manifest;
138140
try {
139-
args.set(urlIndex, extractBuildManifest(iosVersion.ipswURL()).toString());
141+
manifest = extractBuildManifest(iosVersion.ipswURL());
142+
args.set(urlIndex, manifest.toString());
140143
} catch (IOException e) {
141144
throw new TSSException("Unable to extract BuildManifest.", true, e);
142145
}
@@ -146,6 +149,15 @@ private void saveFor(Utils.IOSVersion iosVersion, ArrayList<String> args) throws
146149
parseTSSLog(tssLog);
147150
} catch (IOException e) {
148151
throw new TSSException("There was an error starting tsschecker.", true, e);
152+
} finally {
153+
deleteIfPossible(manifest);
154+
}
155+
}
156+
157+
private void deleteIfPossible(Path file) {
158+
try {
159+
Files.deleteIfExists(file);
160+
} catch (IOException ignored) {
149161
}
150162
}
151163

@@ -232,7 +244,6 @@ private String getBoardConfig() {
232244
return Utils.defaultIfNull(boardConfig, Devices.getBoardConfig(deviceIdentifier));
233245
}
234246

235-
@SuppressWarnings("TextBlockMigration")
236247
private void parseTSSLog(String tsscheckerLog) throws TSSException {
237248
if (containsIgnoreCase(tsscheckerLog, "Saved shsh blobs")) {
238249
return; // success

0 commit comments

Comments
 (0)