Changeset 8956 in josm for trunk/src/org


Ignore:
Timestamp:
2015-10-27T18:46:56+01:00 (4 years ago)
Author:
simon04
Message:

fix #12009 - Preserve filename for conversion GPX -> OSM -> GPX

Regression from r8830.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r8910 r8956  
    3030import java.util.concurrent.Callable;
    3131import java.util.concurrent.CopyOnWriteArrayList;
     32import java.util.regex.Pattern;
    3233
    3334import javax.swing.AbstractAction;
     
    745746            final GpxData data = toGpxData();
    746747            final GpxLayer gpxLayer = new GpxLayer(data, tr("Converted from: {0}", getName()));
    747             gpxLayer.setAssociatedFile(new File(getAssociatedFile().getParentFile(), getAssociatedFile().getName() + ".gpx"));
     748            final String filename = getAssociatedFile().getName().replaceAll(Pattern.quote(".gpx.osm") + "$", "") + ".gpx";
     749            gpxLayer.setAssociatedFile(new File(getAssociatedFile().getParentFile(), filename));
    748750            Main.main.addLayer(gpxLayer);
    749751            if (Main.pref.getBoolean("marker.makeautomarkers", true) && !data.waypoints.isEmpty()) {
Note: See TracChangeset for help on using the changeset viewer.