mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-01 21:17:46 -05:00
Minor cleanup/optimisations to downloading, should help a little bit more with asset downloading.
Closes #359
This commit is contained in:
@@ -89,6 +89,7 @@ public class DownloadUtil {
|
||||
|
||||
if ((code < 200 || code > 299) && code != HttpURLConnection.HTTP_NOT_MODIFIED) {
|
||||
//Didn't get what we expected
|
||||
delete(to);
|
||||
throw new IOException(connection.getResponseMessage() + " for " + from);
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ public class DownloadUtil {
|
||||
try { // Try download to the output
|
||||
FileUtils.copyInputStreamToFile(connection.getInputStream(), to);
|
||||
} catch (IOException e) {
|
||||
to.delete(); // Probably isn't good if it fails to copy/save
|
||||
delete(to); // Probably isn't good if it fails to copy/save
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user