private void saveServers() { File serverDir = new File(settings.getLocalFolder(), "servers"); if (!serverDir.exists()) { serverDir.mkdirs(); } for (Server s : model.getAllServers()) { try { File serverFile = new File(serverDir, s.getName() + ".server"); s.writeToFile(serverFile); } catch (IOException ex) { logger.log(Level.SEVERE, null, ex); } } }
public void deleteKnownServer() { Server currentServer = model.getCurrentServer(); if (currentServer != null) { try { model.removeServer(currentServer); File serverDir = new File(settings.getLocalFolder(), "servers"); File serverFile = new File(serverDir, currentServer.getName() + ".server"); Files.delete(serverFile.toPath()); } catch (IOException ex) { model.addErrorMessage("Server-Datei konnte nicht gelöscht werden"); logger.log(Level.SEVERE, null, ex); } model.fireChange(); } }