diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2020-05-06 13:06:18 -0500 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2020-05-06 13:06:18 -0500 |
| commit | fabb46a639ad38c349e22f5fc0ab37b187772ec3 (patch) | |
| tree | 7d0f5f33f4ad4b4566ac9ba71148e27c6b347ad7 | |
| parent | 3fe6e51780d9d5c789d83060793643c7d9c1ca8d (diff) | |
| download | nimterop-fabb46a639ad38c349e22f5fc0ab37b187772ec3.tar.gz nimterop-fabb46a639ad38c349e22f5fc0ab37b187772ec3.zip | |
Set nimconf paths to absoluteabspath
| -rw-r--r-- | nimterop/nimconf.nim | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/nimterop/nimconf.nim b/nimterop/nimconf.nim index 144a7e0..dca68a8 100644 --- a/nimterop/nimconf.nim +++ b/nimterop/nimconf.nim @@ -95,6 +95,13 @@ proc jsonToSeq(node: JsonNode, key: string): seq[string] = for elem in node[key].getElems(): result.add elem.getStr() +proc getAbsoluteDir(projectDir, path: string): string = + # Path is relative to `projectDir` if not absolute + if path.isAbsolute(): + result = path + else: + result = (projectDir / path).normalizedPath() + proc getNimConfig*(projectDir = ""): Config = # Get `paths` - list of paths to be forwarded to Nim result = new(Config) @@ -146,12 +153,15 @@ proc getNimConfig*(projectDir = ""): Config = # Find non standard lib paths added to `searchPath` for path in searchPaths: + let + path = getAbsoluteDir(projectDir, path) if libPath notin path: result.paths.incl path # Find `nimblePaths` in `lazyPaths` for path in lazyPaths: let + path = getAbsoluteDir(projectDir, path) (_, tail) = path.strip(leading = false, chars = {'/', '\\'}).splitPath() if tail == "pkgs": # Nimble path probably @@ -161,6 +171,8 @@ proc getNimConfig*(projectDir = ""): Config = # Have to do this separately since `nimblePaths` could be after # packages in `lazyPaths` for path in lazyPaths: + let + path = getAbsoluteDir(projectDir, path) var skip = false for npath in result.nimblePaths: if npath in path: |
