diff --git a/src/Gonzo.java b/src/Gonzo.java index 5bb11b1..97fbe1a 100644 --- a/src/Gonzo.java +++ b/src/Gonzo.java @@ -275,7 +275,7 @@ public class Gonzo { if (!Main.windows) {two = new File(System.getProperty("user.home") + "/.firestar/temp/" + oArcTarget).renameTo(new File(Main.outpath + oArcTarget));} else {two = new File(System.getProperty("user.home") + "\\.firestar\\temp\\" + oArcTarget).renameTo(new File(Main.outpath + oArcTarget));} System.out.println("moved file to destination: " + two); - if (one && two) {System.out.println("file should be located at " + Main.outpath + oArcTarget);} else { + if (two) {System.out.println("file should be located at " + Main.outpath + oArcTarget);} else { System.out.println("CRITICAL FAILURE: Please check that your output path is correct and that you have write permissions!"); consoleDisplay.append("CRITICAL FAILURE: Please check that your output path is correct and that you have write permissions!"); JOptionPane.showMessageDialog(this.frame, "CRITICAL FAILURE: Please check that your output path is correct and that you have write permissions!", "Fatal Error", JOptionPane.ERROR_MESSAGE); diff --git a/src/MissPiggy.java b/src/MissPiggy.java index ff678b7..d1f79c0 100644 --- a/src/MissPiggy.java +++ b/src/MissPiggy.java @@ -280,6 +280,22 @@ public class MissPiggy implements ActionListener { public void importModGUI() { // todo call system shell to request file picker + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setCurrentDirectory(new File(System.getProperty("user.home"))); + int result = fileChooser.showOpenDialog(frame); + + if (result == JFileChooser.APPROVE_OPTION) { + File selectedFile = fileChooser.getSelectedFile(); + System.out.println("Importing selected mod file \"" + selectedFile.getName() + "\""); + + ZipFile zipImporterHandler = new ZipFile(selectedFile.getPath()); + if (zipImporterHandler.isValidZipFile()) { + + } else { + System.out.println("ERROR: File is not a valid ZIP archive. Aborting."); + JOptionPane.showMessageDialog(frame, "Whoops, that's not a valid ZIP archive.\nMod files should be in .zip, .agr, .agrc or .agrf.", "Error", JOptionPane.ERROR_MESSAGE); + } + } } public void removeAllGUI() {