Ticket #5602: photo_geotagging.patch

File photo_geotagging.patch, 1.7 KB (added by ax, 15 years ago)
  • GeotaggingAction.java

     
    1313import java.text.DecimalFormat;
    1414import java.util.ArrayList;
    1515import java.util.List;
     16import java.util.UUID;
    1617
    1718import javax.swing.AbstractAction;
    1819import javax.swing.BorderFactory;
     
    4344 * The action to ask the user for confirmation and then do the tagging.
    4445 */
    4546class GeotaggingAction extends AbstractAction implements LayerAction {
     47   
    4648    final static boolean debug = false;
    4749    final static String KEEP_BACKUP = "plugins.photo_geotagging.keep_backup";
    4850    final static String CHANGE_MTIME = "plugins.photo_geotagging.change-mtime";
     
    271273
    272274        private void chooseFilesNoBackup(File file) throws IOException {
    273275            File fileTmp;
    274             fileTmp = File.createTempFile("img", ".jpg", file.getParentFile());
     276            //fileTmp = File.createTempFile("img", ".jpg", file.getParentFile());
     277            // on win32, file.renameTo(fileTmp) does not work when the destination file exists
     278            // see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4017593
     279            // so we cannot use createTempFile(), which would create that "existing destination file"
     280            // instead, let's use new File(), which doesn't actually create a file
     281            // for getting a unique file name, we use UUID.randomUUID()
     282            fileTmp = new File(file.getParentFile(), "img" + UUID.randomUUID() + ".jpg");
    275283            if (debug) {
    276284                System.err.println("TMP: "+fileTmp.getAbsolutePath());
    277285            }