From d661506aaacffd49a93a55d1661b77c8495bb164 Mon Sep 17 00:00:00 2001 From: AJ Date: Tue, 26 Sep 2023 10:33:46 -0700 Subject: [PATCH] Simplify PropertyValueSource.from overload implementation --- .../ajalt/clikt/sources/PropertiesValueSource.kt | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/clikt/src/jvmMain/kotlin/com/github/ajalt/clikt/sources/PropertiesValueSource.kt b/clikt/src/jvmMain/kotlin/com/github/ajalt/clikt/sources/PropertiesValueSource.kt index e599b1dbd..942403661 100644 --- a/clikt/src/jvmMain/kotlin/com/github/ajalt/clikt/sources/PropertiesValueSource.kt +++ b/clikt/src/jvmMain/kotlin/com/github/ajalt/clikt/sources/PropertiesValueSource.kt @@ -57,19 +57,7 @@ object PropertiesValueSource { requireValid: Boolean = false, getKey: (Context, Option) -> String = ValueSource.getKey(joinSubcommands = "."), ): ValueSource { - val properties = Properties() - if (file.isFile) { - try { - file.bufferedReader().use { properties.load(it) } - } catch (e: Throwable) { - if (requireValid) throw InvalidFileFormat( - file.name, - e.message ?: "could not read file" - ) - } - } - - return from(properties, getKey) + return from(file.toPath(), requireValid, getKey) } /**