You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Minor code rearrangement, fix a bug causing the existing mods folder popup to always be shown when use custom loader is unticked, and check if the mods folder is not empty as a condition of showing the popup
intresult = JOptionPane.showConfirmDialog(frame,"An existing mods folder was found in the selected game directory. Do you want to update/install iris?", "Mods Folder Detected",
275
-
JOptionPane.YES_NO_OPTION,
276
-
JOptionPane.QUESTION_MESSAGE);
277
-
if (result != JOptionPane.YES_OPTION) {
278
-
cancelled = true;
271
+
if (modsFolderContents != null) {
272
+
booleanisEmpty = modsFolderContents.length == 0;
273
+
274
+
if (!useCustomLoader && modsFolder.exists() && modsFolder.isDirectory() && !isEmpty) {
275
+
intresult = JOptionPane.showConfirmDialog(frame,"An existing mods folder was found in the selected game directory. Do you want to update/install iris?", "Mods Folder Detected",
if (mod.getName().toLowerCase().contains("optifine") || mod.getName().toLowerCase().contains("optifabric")) {
294
-
if (!shownOptifineDialog) {
295
-
intresult = JOptionPane.showOptionDialog(frame,"Optifine was found in your mods folder, but Optifine is incompatible with Iris. Do you want to remove it, or cancel the installation?", "Optifine Detected",
if (mod.getName().toLowerCase().contains("optifine") || mod.getName().toLowerCase().contains("optifabric")) {
289
+
if (!shownOptifineDialog) {
290
+
intresult = JOptionPane.showOptionDialog(frame,"Optifine was found in your mods folder, but Optifine is incompatible with Iris. Do you want to remove it, or cancel the installation?", "Optifine Detected",
System.out.println("Failed to delete optifine from mods folder");
312
-
JOptionPane.showMessageDialog(frame, "Failed to remove optifine from your mods folder, please make sure your game is closed and try again!", "Failed to remove optifine", JOptionPane.ERROR_MESSAGE);
313
-
cancelled = true;
305
+
if (failedToRemoveOptifine) {
306
+
System.out.println("Failed to delete optifine from mods folder");
307
+
JOptionPane.showMessageDialog(frame, "Failed to remove optifine from your mods folder, please make sure your game is closed and try again!", "Failed to remove optifine", JOptionPane.ERROR_MESSAGE);
308
+
cancelled = true;
309
+
}
314
310
}
315
311
316
-
booleanfailedToRemoveIrisOrSodium = false;
317
-
318
312
if (!cancelled) {
313
+
booleanfailedToRemoveIrisOrSodium = false;
314
+
319
315
for (Filemod : modsFolderContents) {
320
316
if (mod.getName().toLowerCase().contains("iris") || mod.getName().toLowerCase().contains("sodium-fabric")) {
321
317
if (!mod.delete()) failedToRemoveIrisOrSodium = true;
322
318
}
323
319
}
324
-
}
325
320
326
-
if (failedToRemoveIrisOrSodium) {
327
-
System.out.println("Failed to remove Iris or Sodium from mods folder to update them!");
328
-
JOptionPane.showMessageDialog(frame, "Failed to remove iris and sodium from your mods folder to update them, please make sure your game is closed and try again!", "Failed to prepare mods for update", JOptionPane.ERROR_MESSAGE);
329
-
cancelled = true;
321
+
if (failedToRemoveIrisOrSodium) {
322
+
System.out.println("Failed to remove Iris or Sodium from mods folder to update them!");
323
+
JOptionPane.showMessageDialog(frame, "Failed to remove iris and sodium from your mods folder to update them, please make sure your game is closed and try again!", "Failed to prepare mods for update", JOptionPane.ERROR_MESSAGE);
324
+
cancelled = true;
325
+
}
330
326
}
331
327
}
332
328
@@ -335,6 +331,8 @@ public void start() {
335
331
return;
336
332
}
337
333
334
+
if (!modsFolder.exists() || !modsFolder.isDirectory()) modsFolder.mkdir();
0 commit comments