From dd299e23362272648028929083681df3d9fb70f6 Mon Sep 17 00:00:00 2001 From: RoB Murdock Date: Tue, 10 Sep 2024 12:49:24 -0400 Subject: [PATCH] [patch] fixing js config file error --- .../kotlin/com/zegreatrob/tools/cli/ReadFromFile.js.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/cli-tools/src/jsMain/kotlin/com/zegreatrob/tools/cli/ReadFromFile.js.kt b/tools/cli-tools/src/jsMain/kotlin/com/zegreatrob/tools/cli/ReadFromFile.js.kt index 450c7eb..7c215fb 100644 --- a/tools/cli-tools/src/jsMain/kotlin/com/zegreatrob/tools/cli/ReadFromFile.js.kt +++ b/tools/cli-tools/src/jsMain/kotlin/com/zegreatrob/tools/cli/ReadFromFile.js.kt @@ -3,6 +3,9 @@ package com.zegreatrob.tools.cli import kotlin.js.json private val fs = js("require('node:fs')") -actual fun readFromFile(fileName: String): String? = +actual fun readFromFile(fileName: String): String? = if (fs.existsSync(fileName).unsafeCast()) { fs.readFileSync(fileName, json("encoding" to "utf-8")) .unsafeCast() +} else { + null +}