newFilePath = newFilePath + ".";
newFilePath += ".";
        public void approveSelection ()        {            File file = new File(getSelectedFile().getAbsolutePath());            TiledFileFilter saver = (TiledFileFilter) getFileFilter();            // If the file does not have an extention, append the first            // extension specified by the file filter.            String filename = file.getName();            int lastDot = filename.lastIndexOf('.');            if (lastDot == -1 || lastDot == filename.length() - 1) {                if (saver.getType() == TiledFileFilter.FILTER_EXT) {                    // Impossible to determine extension with this filter                    JOptionPane.showMessageDialog(this,                                                  UNKNOWN_TYPE_MESSAGE);                    return;                }                String newFilePath = file.getAbsolutePath();                // Add a dot if it wasn't at the end already                if (lastDot != filename.length() - 1) {                    newFilePath = newFilePath + ".";                }                file = new File(newFilePath + saver.getFirstExtention());            }            // Check that chosen plugin accepts the file. It is a good idea to            // warn the user when this is not the case, because loading the map            // becomes a problem.            if (saver.getType() != TiledFileFilter.FILTER_EXT) {                if (!saver.accept(file)) {                    int result = JOptionPane.showConfirmDialog(                            editor.getAppFrame(),                            CONFIRM_MISMATCH, CONFIRM_MISMATCH_TITLE,                            JOptionPane.YES_NO_OPTION);                    if (result != JOptionPane.OK_OPTION) {                        return;                    }                }            }            // Confirm overwrite if the file happens to exist already            if (file.exists())            {                int answer = JOptionPane.showConfirmDialog(                        editor.getAppFrame(),                        FILE_EXISTS_MESSAGE, FILE_EXISTS_TITLE,                        JOptionPane.YES_NO_OPTION);                if (answer == JOptionPane.YES_OPTION)                {                    savingCancelled = false;                    super.approveSelection();                }            }            else {                savingCancelled = false;                super.approveSelection();            }        }