Changeset 30457 in osm for applications


Ignore:
Timestamp:
2014-05-19T15:25:04+02:00 (10 years ago)
Author:
bastik
Message:

see #josm10045 - Could not rename file! when writing geolocation data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/photo_geotagging/src/org/openstreetmap/josm/plugins/photo_geotagging/GeotaggingAction.java

    r30355 r30457  
    1 //License: GPL (v2 or above)
     1//License: GPL (v2 or later)
    22package org.openstreetmap.josm.plugins.photo_geotagging;
    33
     
    283283            // instead, let's use new File(), which doesn't actually create a file
    284284            // for getting a unique file name, we use UUID.randomUUID()
    285             fileTmp = new File(file.getParentFile(), "img" + UUID.randomUUID() + ".jpg");
     285            do {
     286                fileTmp = new File(file.getParentFile(), "img" + UUID.randomUUID() + ".jpg");
     287            } while (fileTmp.exists());
    286288            if (debug) {
    287289                System.err.println("TMP: "+fileTmp.getAbsolutePath());
    288290            }
    289291            if (! file.renameTo(fileTmp))
    290                 throw new IOException(tr("Could not rename file!"));
     292                throw new IOException(tr("Could not rename file {0} to {1}!", file, fileTmp));
    291293
    292294            fileFrom = fileTmp;
Note: See TracChangeset for help on using the changeset viewer.