@Override protected Boolean doInBackground() throws Exception { String installPath = Settings.getSettings().getInstallPath(); Map map = Map.getMap(LaunchFrame.getSelectedMapIndex()); if (new File( installPath, map.getSelectedCompatible() + "/minecraft/saves/" + map.getMapName()) .exists()) { MapOverwriteDialog dialog = new MapOverwriteDialog(LaunchFrame.getInstance(), true); dialog.setVisible(true); if (overwrite) { FileUtils.delete( new File( installPath, map.getSelectedCompatible() + "/minecraft/saves/" + map.getMapName())); } else { Logger.logInfo("Canceled map installation."); return false; } } downloadMap(map.getUrl(), map.getMapName()); return false; }
public static void cleanUp() { Map map = Map.getMap(LaunchFrame.getSelectedMapIndex()); File tempFolder = new File(OSUtils.getDynamicStorageLocation(), "Maps" + sep + map.getMapName() + sep); for (String file : tempFolder.list()) { if (!file.equals(map.getLogoName()) && !file.equals(map.getImageName()) && !file.equalsIgnoreCase("version")) { try { FileUtils.delete(new File(tempFolder, file)); } catch (IOException e) { } } } }