1
0
Fork 0

0.27: Fix first ever recorded filename being log0 (now all are dated)

master
Gordon Williams 2023-06-09 16:58:00 +01:00
parent 7fa165f421
commit f8ccc2f596
3 changed files with 4 additions and 3 deletions

View File

@ -32,3 +32,4 @@
0.24: Can now specify `setRecording(true, {force:...` to not show a menu
0.25: Widget now has `isRecording()` for retrieving recording status.
0.26: Now record filename based on date
0.27: Fix first ever recorded filename being log0 (now all are dated)

View File

@ -2,7 +2,7 @@
"id": "recorder",
"name": "Recorder",
"shortName": "Recorder",
"version": "0.26",
"version": "0.27",
"description": "Record GPS position, heart rate and more in the background, then download to your PC.",
"icon": "app.png",
"tags": "tool,outdoors,gps,widget",

View File

@ -240,8 +240,9 @@
var settings = loadSettings();
options = options||{};
if (isOn && !settings.recording) {
var date=(new Date()).toISOString().substr(0,10).replace(/-/g,""), trackNo=10;
if (!settings.file) { // if no filename set
settings.file = "recorder.log0.csv";
settings.file = "recorder.log" + date + trackNo.toString(36) + ".csv";;
} else if (require("Storage").list(settings.file).length){ // if file exists
if (!options.force) { // if not forced, ask the question
g.reset(); // work around bug in 2v17 and earlier where bg color wasn't reset
@ -263,7 +264,6 @@
require("Storage").open(settings.file,"r").erase();
} else if (options.force=="new") {
// new file - use the current date
var date=(new Date()).toISOString().substr(0,10).replace(/-/g,""), trackNo=10;
var newFileName;
do { // while a file exists, add one to the letter after the date
newFileName = "recorder.log" + date + trackNo.toString(36) + ".csv";