more reliable Remove All
This commit is contained in:
parent
a9f0fc3f4c
commit
2735c311ad
|
@ -289,7 +289,7 @@ public class Gonzo {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
File tmp = new File(System.getProperty("user.home") + "/.firestar/temp/");
|
File tmp = new File(System.getProperty("user.home") + "/.firestar/temp/");
|
||||||
deleteDir(tmp);
|
Main.deleteDir(tmp);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("WARNING: Temporary files may not have been properly cleared.\n" + e.getMessage());
|
System.out.println("WARNING: Temporary files may not have been properly cleared.\n" + e.getMessage());
|
||||||
consoleDisplay.append("WARNING: Temporary files may not have been properly cleared.\n" + e.getMessage());
|
consoleDisplay.append("WARNING: Temporary files may not have been properly cleared.\n" + e.getMessage());
|
||||||
|
@ -345,16 +345,4 @@ public class Gonzo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteDir(File file) { // https://stackoverflow.com/a/29175213/9259829
|
|
||||||
File[] contents = file.listFiles();
|
|
||||||
if (contents != null) {
|
|
||||||
for (File f : contents) {
|
|
||||||
if (! Files.isSymbolicLink(f.toPath())) {
|
|
||||||
deleteDir(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
file.delete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,4 +128,16 @@ public class Main {
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void deleteDir(File file) { // https://stackoverflow.com/a/29175213/9259829
|
||||||
|
File[] contents = file.listFiles();
|
||||||
|
if (contents != null) {
|
||||||
|
for (File f : contents) {
|
||||||
|
if (! Files.isSymbolicLink(f.toPath())) {
|
||||||
|
deleteDir(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -396,11 +396,7 @@ public class MissPiggy implements ActionListener {
|
||||||
int result = JOptionPane.showConfirmDialog(frame, "Do you really want to delete all mods?", "Remove All", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
|
int result = JOptionPane.showConfirmDialog(frame, "Do you really want to delete all mods?", "Remove All", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
|
||||||
|
|
||||||
if (result == JOptionPane.YES_OPTION) {
|
if (result == JOptionPane.YES_OPTION) {
|
||||||
for (Main.Mod entry : Main.Mods) {
|
Main.deleteDir(new File(System.getProperty("user.home") + "/.firestar/mods/"));
|
||||||
new File(System.getProperty("user.home") + "/.firestar/mods/" + entry.path).delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
new File(System.getProperty("user.home") + "/.firestar/mods/index").delete();
|
|
||||||
Main.Mods.clear();
|
Main.Mods.clear();
|
||||||
|
|
||||||
InitializeModListStructure();
|
InitializeModListStructure();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user