diff options
author | Linnea Gräf <nea@nea.moe> | 2024-04-19 20:57:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-19 20:57:07 +0200 |
commit | 40309bc8acb7afb37bbc99d7a758c24ffd962b4c (patch) | |
tree | cfabc8d261d820ea63921bead05e20feb67f4a4f /buildSrc/src/EnvFile.kt | |
parent | f3b6288fed75eacede95627282cb9bfec73f0c9e (diff) | |
download | skyhanni-40309bc8acb7afb37bbc99d7a758c24ffd962b4c.tar.gz skyhanni-40309bc8acb7afb37bbc99d7a758c24ffd962b4c.tar.bz2 skyhanni-40309bc8acb7afb37bbc99d7a758c24ffd962b4c.zip |
Backend: Add unimined build system (#1456)
Diffstat (limited to 'buildSrc/src/EnvFile.kt')
-rw-r--r-- | buildSrc/src/EnvFile.kt | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/buildSrc/src/EnvFile.kt b/buildSrc/src/EnvFile.kt new file mode 100644 index 000000000..76d6fa959 --- /dev/null +++ b/buildSrc/src/EnvFile.kt @@ -0,0 +1,12 @@ +import java.io.File + +fun parseEnvFile(file: File): Map<String, String> { + if (!file.exists()) return mapOf() + val map = mutableMapOf<String, String>() + 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 +} |