Changeset 17669 in josm


Ignore:
Timestamp:
2021-03-26T21:07:11+01:00 (4 years ago)
Author:
simon04
Message:

fix #18569 - JOSM crash corrupts preferences.xml (use file move; patch by michael2402)

File:
1 edited

Legend:

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

    r17541 r17669  
    1414import java.io.StringWriter;
    1515import java.nio.charset.StandardCharsets;
     16import java.nio.file.Files;
    1617import java.nio.file.InvalidPathException;
     18import java.nio.file.StandardCopyOption;
    1719import java.util.ArrayList;
    1820import java.util.Arrays;
     
    448450
    449451        File tmpFile = new File(prefFile + "_tmp");
    450         Utils.copyFile(tmpFile, prefFile);
    451         Utils.deleteFile(tmpFile, marktr("Unable to delete temporary file {0}"));
     452        Files.move(tmpFile.toPath(), prefFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
    452453
    453454        setCorrectPermissions(prefFile);
Note: See TracChangeset for help on using the changeset viewer.