Changeset 3275 in osm for applications/editors/josm


Ignore:
Timestamp:
2007-06-20T14:22:49+02:00 (17 years ago)
Author:
christofd
Message:

write data to surveyor...osm file, not to file of datalayer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveEditLayerTimerTask.java

    r2936 r3275  
    4444            DataSet dataset = layer.data;
    4545
    46             File outFile = layer.associatedFile;
    47             if(outFile == null) {
    48                 outFile = file;
     46//            File outFile = layer.associatedFile;
     47//            if(outFile == null) {
     48//                outFile = file;
     49//            }
     50           
     51            // write to temporary file, on success, rename tmp file to target file:
     52            File tmpFile = new File(file.getAbsoluteFile()+".tmp");
     53            System.out.println("AutoSaving osm data to file " + file.getAbsolutePath());
     54            synchronized(LiveGpsLock.class) {
     55                XmlWriter.output(new FileOutputStream(tmpFile), new OsmWriter.All(dataset, false));
    4956            }
    50             System.out.println("AutoSaving osm data to file " + outFile.getAbsolutePath());
    51             synchronized(LiveGpsLock.class) {
    52                 XmlWriter.output(new FileOutputStream(outFile), new OsmWriter.All(dataset, false));
    53             }
     57            tmpFile.renameTo(file);
    5458            System.out.println("AutoSaving finished");
    5559        } catch (IOException x) {
Note: See TracChangeset for help on using the changeset viewer.