This commit is contained in:
Milos Kozak 2020-07-21 22:14:46 +02:00
parent 2a8f9bd7d3
commit 74ca36bb6e
2 changed files with 23 additions and 22 deletions

View file

@ -65,11 +65,10 @@ class MaintenancePlugin @Inject constructor(
//todo replace this with a call on startup of the application, specifically to remove //todo replace this with a call on startup of the application, specifically to remove
// unnecessary garbage from the log exports // unnecessary garbage from the log exports
fun deleteLogs() { fun deleteLogs() {
val logDirectory = LoggerUtils.getLogDirectory() LoggerUtils.getLogDirectory()?.let { logDirectory ->
val logDir = File(logDirectory) val logDir = File(logDirectory)
val files = logDir.listFiles { _: File?, name: String -> val files = logDir.listFiles { _: File?, name: String ->
(name.startsWith("AndroidAPS") (name.startsWith("AndroidAPS") && name.endsWith(".zip"))
&& name.endsWith(".zip"))
} }
Arrays.sort(files) { f1: File, f2: File -> f1.name.compareTo(f2.name) } Arrays.sort(files) { f1: File, f2: File -> f1.name.compareTo(f2.name) }
var delFiles = listOf(*files) var delFiles = listOf(*files)
@ -90,6 +89,7 @@ class MaintenancePlugin @Inject constructor(
exportDir.delete() exportDir.delete()
} }
} }
}
/** /**
* returns a list of log files. The number of returned logs is given via the amount * returns a list of log files. The number of returned logs is given via the amount

View file

@ -88,6 +88,7 @@ public class CareportalEvent implements DataPointWithLabelInterface, Interval {
} }
public CareportalEvent(NSMbg mbg) { public CareportalEvent(NSMbg mbg) {
this();
date = mbg.date; date = mbg.date;
eventType = MBG; eventType = MBG;
json = mbg.json; json = mbg.json;