File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
src/main/java/com/falsepattern/lib/dependencies Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -121,10 +121,7 @@ public static void loadLibrary(@NonNull String loadingModId,
121
121
return ;
122
122
} catch (RuntimeException e ) {
123
123
log .warn ("Failed to load library {} from file! Re-downloading..." , artifactLogName );
124
- if (!file .delete ()) {
125
- log .fatal ("Failed to delete file {}" , file );
126
- throw new RuntimeException ("Failed to delete file " + file );
127
- }
124
+ checkedDelete (file );
128
125
}
129
126
}
130
127
if (!LibraryConfig .ENABLE_LIBRARY_DOWNLOADS ) {
@@ -185,7 +182,8 @@ public static void loadLibrary(@NonNull String loadingModId,
185
182
if (!fileHash .equals (referenceHash )) {
186
183
log .error ("Failed {} checksum validation for {}. Retrying download..." ,
187
184
checksumType , artifactLogName );
188
- file .delete ();
185
+ checkedDelete (file );
186
+ checkedDelete (checksumFile );
189
187
retry = true ;
190
188
continue redownload ;
191
189
}
@@ -252,6 +250,13 @@ private static String hash(String algo, File file) {
252
250
return digest (algo , data );
253
251
}
254
252
253
+ private static void checkedDelete (File file ) {
254
+ if (!file .delete ()) {
255
+ log .fatal ("Failed to delete file {}" , file );
256
+ throw new RuntimeException ("Failed to delete file " + file );
257
+ }
258
+ }
259
+
255
260
private static void addToClasspath (File file ) {
256
261
try {
257
262
val cl = (LaunchClassLoader ) DependencyLoader .class .getClassLoader ();
You can’t perform that action at this time.
0 commit comments