From 7e0151569477df63601be50c82177ecfd21e5deb Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Fri, 26 Apr 2024 18:04:45 +0200 Subject: Bump to 1.20.5 --- buildSrc/src/EnvFile.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 buildSrc/src/EnvFile.kt (limited to 'buildSrc/src/EnvFile.kt') diff --git a/buildSrc/src/EnvFile.kt b/buildSrc/src/EnvFile.kt new file mode 100644 index 0000000..8a46398 --- /dev/null +++ b/buildSrc/src/EnvFile.kt @@ -0,0 +1,18 @@ +/* + * SPDX-FileCopyrightText: 2024 Linnea Gräf + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import java.io.File + +fun parseEnvFile(file: File): Map { + if (!file.exists()) return mapOf() + val map = mutableMapOf() + for (line in file.readText().lines()) { + if (line.isEmpty() || line.startsWith("#")) continue + val parts = line.split("=", limit = 2) + map[parts[0]] = parts.getOrNull(1) ?: "" + } + return map +} -- cgit