Changeset 6011 in josm for trunk/src/org


Ignore:
Timestamp:
2013-06-16T14:27:13+02:00 (11 years ago)
Author:
Don-vip
Message:

fix #8792 - correct save of file containing a dot in their name, without extension

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java

    r5460 r6011  
    147147        if (fc == null) return null;
    148148        File file = fc.getSelectedFile();
    149         String fn = file.getPath();
    150         if (fn.indexOf('.') == -1)
    151         {
    152             FileFilter ff = fc.getFileFilter();
     149       
     150        FileFilter ff = fc.getFileFilter();
     151        if (!ff.accept(file)) {
     152            // Extension of another filefilter given ?
     153            for (FileFilter cff : fc.getChoosableFileFilters()) {
     154                if (cff.accept(file)) {
     155                    fc.setFileFilter(cff);
     156                    return file;
     157                }
     158            }
     159            // No filefilter accepts current filename, add default extension
     160            String fn = file.getPath();
    153161            if (ff instanceof ExtensionFileFilter) {
    154162                fn += "." + ((ExtensionFileFilter)ff).getDefaultExtension();
Note: See TracChangeset for help on using the changeset viewer.