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,
121121 return ;
122122 } catch (RuntimeException e ) {
123123 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 );
128125 }
129126 }
130127 if (!LibraryConfig .ENABLE_LIBRARY_DOWNLOADS ) {
@@ -185,7 +182,8 @@ public static void loadLibrary(@NonNull String loadingModId,
185182 if (!fileHash .equals (referenceHash )) {
186183 log .error ("Failed {} checksum validation for {}. Retrying download..." ,
187184 checksumType , artifactLogName );
188- file .delete ();
185+ checkedDelete (file );
186+ checkedDelete (checksumFile );
189187 retry = true ;
190188 continue redownload ;
191189 }
@@ -252,6 +250,13 @@ private static String hash(String algo, File file) {
252250 return digest (algo , data );
253251 }
254252
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+
255260 private static void addToClasspath (File file ) {
256261 try {
257262 val cl = (LaunchClassLoader ) DependencyLoader .class .getClassLoader ();
You can’t perform that action at this time.
0 commit comments