Files
bibleref/src/offline_data.nim
T
2026-06-29 08:16:27 -05:00

16 lines
625 B
Nim

import std/os
template translationDataPath(name: static[string], visibility: static[string]): string =
const dataRoot = currentSourcePath().parentDir.parentDir / "data"
dataRoot / visibility / (name & ".tsv")
template hasEmbeddedTranslationData*(name: static[string]): bool =
fileExists(translationDataPath(name, "private")) or
fileExists(translationDataPath(name, "public"))
template embeddedTranslationData*(name: static[string]): string =
when fileExists(translationDataPath(name, "private")):
staticRead(translationDataPath(name, "private"))
else:
staticRead(translationDataPath(name, "public"))