Changeset 4852 in josm


Ignore:
Timestamp:
2012-01-22T20:56:24+01:00 (8 years ago)
Author:
bastiK
Message:

fixed #6252 - Phantom "unsaved" layers in 4021, 4032

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/AutosaveTask.java

    r3839 r4852  
    167167            if (file != null) {
    168168                info.backupFiles.add(file);
    169                 new OsmExporter().exportData(file, info.layer);
     169                new OsmExporter().exportData(file, info.layer, true /* no backup with appended ~ */);
    170170            }
    171171        }
  • trunk/src/org/openstreetmap/josm/io/OsmExporter.java

    r4645 r4852  
    4141    @Override
    4242    public void exportData(File file, Layer layer) throws IOException {
     43        exportData(file, layer, false);
     44    }
     45
     46    public void exportData(File file, Layer layer, boolean noBackup) throws IOException {
    4347        if (layer instanceof OsmDataLayer) {
    44             save(file, (OsmDataLayer) layer);
     48            save(file, (OsmDataLayer) layer, noBackup);
    4549        } else
    4650            throw new IllegalArgumentException(MessageFormat.format("Expected instance of OsmDataLayer. Got ''{0}''.", layer
     
    5256    }
    5357
    54     private void save(File file, OsmDataLayer layer) {
     58    private void save(File file, OsmDataLayer layer, boolean noBackup) {
    5559        File tmpFile = null;
    5660        try {
     
    7983            }
    8084            // FIXME - how to close?
    81             if (!Main.pref.getBoolean("save.keepbackup", false) && (tmpFile != null)) {
    82                 tmpFile.delete();
     85            if (noBackup || !Main.pref.getBoolean("save.keepbackup", false)) {
     86                if (tmpFile != null) {
     87                    tmpFile.delete();
     88                }
    8389            }
    8490            layer.onPostSaveToFile();
Note: See TracChangeset for help on using the changeset viewer.