From 94887140af27012ccef17e2e6f3ea315fced8f02 Mon Sep 17 00:00:00 2001 From: Kevin Salazar Date: Mon, 9 Dec 2024 08:10:18 -0600 Subject: [PATCH] Fix #333: Change exported GPX filenames to 'YYYY-MM-DD_hh-mm-ss_OSMTracker.gpx' --- .../main/java/net/osmtracker/gpx/ExportToTempFileTask.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/net/osmtracker/gpx/ExportToTempFileTask.java b/app/src/main/java/net/osmtracker/gpx/ExportToTempFileTask.java index 8c1a3d30..03871a0b 100644 --- a/app/src/main/java/net/osmtracker/gpx/ExportToTempFileTask.java +++ b/app/src/main/java/net/osmtracker/gpx/ExportToTempFileTask.java @@ -4,6 +4,7 @@ import android.database.Cursor; import android.util.Log; +import net.osmtracker.db.DataHelper; import net.osmtracker.exception.ExportTrackException; import java.io.File; @@ -25,9 +26,10 @@ public abstract class ExportToTempFileTask extends ExportTrackTask { public ExportToTempFileTask(Context context, long trackId) { super(context, trackId); try { - tmpFile = File.createTempFile("osm-upload", ".gpx", context.getCacheDir()); + tmpFile = new File(context.getCacheDir(), new DataHelper(context).getTrackById(trackId).getName()+"_OSMTracker.gpx"); Log.d(TAG, "Temporary file: " + tmpFile.getAbsolutePath()); - } catch (IOException ioe) { + + } catch (Exception ioe) { Log.e(TAG, "Could not create temporary file", ioe); throw new IllegalStateException("Could not create temporary file", ioe); }