Skip to content

Commit

Permalink
don't fail if eventsFile doesn't exist
Browse files Browse the repository at this point in the history
dkandalov committed Sep 29, 2024
1 parent 00dae31 commit 44c26d4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/activitytracker/TrackerLog.kt
Original file line number Diff line number Diff line change
@@ -57,6 +57,8 @@ class TrackerLog(private val eventsFilePath: String) {
fun clearLog(): Boolean = FileUtil.delete(eventsFile)

fun readEvents(onParseError: (String, Exception) -> Any): Sequence<TrackerEvent> {
if (!eventsFile.exists()) return emptySequence()

val reader = eventsFile.bufferedReader(UTF_8)
val parser = CSVParser(reader, CSVFormat.RFC4180)
val sequence = parser.asSequence().map { csvRecord ->

0 comments on commit 44c26d4

Please sign in to comment.