read version from nimble config file

This commit is contained in:
Xie Yanbo 2020-02-19 19:11:11 +08:00
parent d5b9e5474d
commit aa73784d72
1 changed files with 10 additions and 2 deletions

View File

@ -19,11 +19,19 @@ type
LevelDbException* = object of Exception
const
version* = block:
let content = staticRead"../leveldb.nimble"
var version_line: string
for line in content.split("\L"):
if line.startsWith("version"):
version_line = line
break
let raw = version_line.split("=", maxsplit = 1)[1]
raw.strip().strip(chars = {'"'})
levelDbTrue = uint8(1)
levelDbFalse = uint8(0)
version* = "0.3.0"
proc free(p: pointer) {.importc.}
proc checkError(errPtr: cstring) =