Skip to content

Commit 7ef5941

Browse files
authored
Fix compile error when using custom nimble env (pietroppeter#216)
Fix pietroppeter#216
1 parent dc89060 commit 7ef5941

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/nimib/config.nim

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
import types, parsetoml, jsony, std / [json, os, osproc, math, sequtils]
1+
import types, parsetoml, jsony, std / [json, os, osproc, math, sequtils, re]
22

33
proc getNimibVersion*(): string =
44
var dir = currentSourcePath().parentDir().parentDir()
55

66
if dir.splitPath().tail == "src":
77
dir = dir.parentDir()
88

9-
let dumpedJson = execProcess("nimble dump --json", dir)
9+
let dumpedJson = execProcess("nimble dump", dir)
1010

11-
result = parseJson(dumpedJson)["version"].getStr()
11+
let pattern = re("""^version: "(.*)"$""", {reMultiLine})
12+
var match: array[1, string]
13+
14+
discard dumpedJson.find(pattern, match)
15+
16+
result = match[0]
1217

1318
proc hasCfg*(doc: var NbDoc): bool = doc.cfgDir.string != ""
1419

0 commit comments

Comments
 (0)