fix package compile issue

Error message: "Error: cannot open file: ../leveldb.nimble"
This commit is contained in:
Xie Yanbo 2020-02-23 15:43:12 +08:00
parent ba45990676
commit 713b036f98
2 changed files with 13 additions and 2 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
nimcache/
/test.db/
/leveldb.e
tests/packagetest/packagetest
src/leveldb
tests/test

View File

@ -1,4 +1,4 @@
import options, strutils, leveldbpkg/raw
import options, os, strutils, leveldbpkg/raw
type
LevelDb* = ref object
@ -20,7 +20,15 @@ type
const
version* = block:
let content = staticRead"../leveldb.nimble"
const configFile = "leveldb.nimble"
const sourcePath = currentSourcePath()
const parentConfig = sourcePath.parentDir.parentDir / configFile
const localConfig = sourcePath.parentDir / configFile
var content: string
if fileExists(parentConfig):
content = staticRead(parentConfig)
else:
content = staticRead(localConfig)
var version_line: string
for line in content.split("\L"):
if line.startsWith("version"):