changed saveDataToGpx so that it saves the dateDirectory in filenames, too
This commit is contained in:
parent
6b221be979
commit
4a8803b341
1 changed files with 4 additions and 6 deletions
|
@ -204,23 +204,21 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
|||
File fout = new File(dir, f + ".gpx"); //$NON-NLS-1$
|
||||
if (!data.get(f).isEmpty()) {
|
||||
WptPt pt = data.get(f).findPointToShow();
|
||||
File targetDir = dir;
|
||||
String fileName = f + "_" + new SimpleDateFormat("HH-mm_EEE", Locale.US).format(new Date(pt.time)); //$NON-NLS-1$
|
||||
if (ctx.getSettings().STORE_TRACKS_IN_MONTHLY_DIRECTORIES.get()) {
|
||||
SimpleDateFormat dateDirFormat = new SimpleDateFormat("yyyy-MM");
|
||||
String dateDirName = dateDirFormat.format(new Date(pt.time));
|
||||
File dateDir = new File(dir, dateDirName);
|
||||
dateDir.mkdirs();
|
||||
if (dateDir.exists()) {
|
||||
targetDir = dateDir;
|
||||
fileName = dateDirName + File.separator + fileName;
|
||||
}
|
||||
}
|
||||
|
||||
String fileName = f + "_" + new SimpleDateFormat("HH-mm_EEE", Locale.US).format(new Date(pt.time)); //$NON-NLS-1$
|
||||
filenames.add(fileName);
|
||||
fout = new File(targetDir, fileName + ".gpx"); //$NON-NLS-1$
|
||||
fout = new File(dir, fileName + ".gpx"); //$NON-NLS-1$
|
||||
int ind = 1;
|
||||
while (fout.exists()) {
|
||||
fout = new File(targetDir, fileName + "_" + (++ind) + ".gpx"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fout = new File(dir, fileName + "_" + (++ind) + ".gpx"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue