Skip to content

Commit

Permalink
Fix compile error when using custom nimble env (pietroppeter#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
sent44 authored Aug 19, 2023
1 parent dc89060 commit 7ef5941
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/nimib/config.nim
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import types, parsetoml, jsony, std / [json, os, osproc, math, sequtils]
import types, parsetoml, jsony, std / [json, os, osproc, math, sequtils, re]

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

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

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

result = parseJson(dumpedJson)["version"].getStr()
let pattern = re("""^version: "(.*)"$""", {reMultiLine})
var match: array[1, string]

discard dumpedJson.find(pattern, match)

result = match[0]

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

Expand Down

0 comments on commit 7ef5941

Please sign in to comment.