Skip to content

Commit

Permalink
Fix a couple of issues:
Browse files Browse the repository at this point in the history
• Fix a bug where the wrong platform was reported.
• Make it easier to debug the Android/JVM folder scanning.
  • Loading branch information
airxnoor committed Apr 11, 2024
1 parent 938fb10 commit e577af1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.2.4 - April 11, 2024
• Fix a bug where the wrong platform was reported.
• Make it easier to debug the Android/JVM folder scanning.

0.2.3 - April 10, 2024
• Fix a bug when extracting date from a file name.

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

rootProject.group = "com.airthings.lib"
rootProject.version = "0.2.3"
rootProject.version = "0.2.4"

buildscript {
repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ internal actual class PlatformFileInputOutputImpl : PlatformFileInputOutput {
path: String,
date: LogDate?,
): Collection<String> = ArrayList<String>(INITIAL_ARRAY_SIZE).apply {
val iterator = File(path).walk().iterator()
val filePath = File(path)
val fileWalker = filePath.walkTopDown()
val iterator = fileWalker.iterator()

while (iterator.hasNext()) {
val file = iterator.next()
Expand Down
2 changes: 2 additions & 0 deletions src/commonMain/kotlin/com/airthings/lib/logging/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ internal const val PLATFORM_ANDROID: String = "Android"

internal const val PLATFORM_IOS: String = "iOS"

internal const val PLATFORM_JVM: String = "jvm"

internal const val INITIAL_ARRAY_SIZE: Int = 50

internal const val INITIAL_BLOCK_SIZE: Int = 256
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package com.airthings.lib.logging.platform

import com.airthings.lib.logging.INITIAL_ARRAY_SIZE
import com.airthings.lib.logging.LogDate
import com.airthings.lib.logging.PLATFORM_ANDROID
import com.airthings.lib.logging.PLATFORM_JVM
import com.airthings.lib.logging.ifAfter
import java.io.File
import java.io.FileOutputStream
Expand Down Expand Up @@ -84,13 +84,15 @@ internal actual class PlatformFileInputOutputImpl : PlatformFileInputOutput {
date = date,
)

override fun toString(): String = PLATFORM_ANDROID
override fun toString(): String = PLATFORM_JVM

private fun filesImpl(
path: String,
date: LogDate?,
): Collection<String> = ArrayList<String>(INITIAL_ARRAY_SIZE).apply {
val iterator = File(path).walk().iterator()
val filePath = File(path)
val fileWalker = filePath.walkTopDown()
val iterator = fileWalker.iterator()

while (iterator.hasNext()) {
val file = iterator.next()
Expand Down

0 comments on commit e577af1

Please sign in to comment.