mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2026-09-13 11:34:13 +00:00
12 lines
413 B
Kotlin
12 lines
413 B
Kotlin
import dev.inmo.micro_utils.common.MPPFile
|
|
import java.io.File
|
|
|
|
/** JVM picker backed by [File], returning a file root directly or descending through random directory children. */
|
|
actual fun pickFile(currentRoot: MPPFile): File? {
|
|
if (currentRoot.isFile) {
|
|
return currentRoot
|
|
} else {
|
|
return pickFile(currentRoot.listFiles() ?.takeIf { it.isNotEmpty() } ?.random() ?: return null)
|
|
}
|
|
}
|