From 4ff2b2e929c2ce789667373101b0a176643bec53 Mon Sep 17 00:00:00 2001 From: Pavol Zibrita Date: Mon, 10 Oct 2011 15:32:45 +0200 Subject: [PATCH] Even with millis, do not overwrite existing gpx files --- .../src/net/osmand/plus/activities/SavingTrackHelper.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java index 29b72bf580..02b63cbd36 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java +++ b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java @@ -140,7 +140,12 @@ public class SavingTrackHelper extends SQLiteOpenHelper { File fout = new File(dir, f + ".gpx"); //$NON-NLS-1$ if (fout.exists() && !data.get(f).isEmpty()) { - fout = new File(dir, f + "." + new SimpleDateFormat("HHmmss.EEEE").format(new Date(data.get(f).findPointToShow().time)) + ".gpx"); //$NON-NLS-1$ //$NON-NLS-2$ + f = f + "_" + new SimpleDateFormat("HH-mm.EEEE").format(new Date(data.get(f).findPointToShow().time)); //$NON-NLS-1$ + fout = new File(dir, f + ".gpx"); //$NON-NLS-1$ + int ind = 1; + while (fout.exists()) { + fout = new File(dir, f + "_" + (++ind) + ".gpx"); //$NON-NLS-1$ //$NON-NLS-2$ + } } String warn = GPXUtilities.writeGpxFile(fout, data.get(f), ctx);