1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2025-01-13 11:17:33 +01:00

Bangle.js: clear fetched csv if refetching

This commit is contained in:
Ganblejs 2024-02-17 21:22:25 +01:00 committed by José Rebelo
parent 6255ff615d
commit d3229dea96

View File

@ -761,12 +761,17 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
String line = json.getString("line"); String line = json.getString("line");
LOG.info(line); LOG.info(line);
String mode = "append";
if (line.equals("")) {
mode = "write";
}
File outputFile = new File(dir, filename); File outputFile = new File(dir, filename);
String filenameLogID = "latestFetchedRecorderLog.txt"; String filenameLogID = "latestFetchedRecorderLog.txt";
File outputFileLogID = new File(dir, filenameLogID); File outputFileLogID = new File(dir, filenameLogID);
LOG.warn("Writing log to " + outputFile.toString()); LOG.warn("Writing log to " + outputFile.toString());
try { try {
FileUtils.copyStringToFile(line,outputFile,"append"); FileUtils.copyStringToFile(line,outputFile,mode);
//GB.toast(getContext(), "Log written to " + filename, Toast.LENGTH_LONG, GB.INFO); //GB.toast(getContext(), "Log written to " + filename, Toast.LENGTH_LONG, GB.INFO);
FileUtils.copyStringToFile(log,outputFileLogID,""); FileUtils.copyStringToFile(log,outputFileLogID,"");