aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2018-07-08 19:11:41 -0500
committerGanesh Viswanathan <dev@genotrance.com>2018-07-08 19:11:41 -0500
commit60d94e9114832ee8f46ca73dccb761706aed364d (patch)
tree209eee6f21553f60ef5222842e05a865513e1620
parenta717b9d140b1f6b77e998d020360cffa11ae21eb (diff)
downloadnimgen-60d94e9114832ee8f46ca73dccb761706aed364d.tar.gz
nimgen-60d94e9114832ee8f46ca73dccb761706aed364d.zip
Fix for absolute paths in includes and headers
-rw-r--r--nimgen.nim18
1 files changed, 12 insertions, 6 deletions
diff --git a/nimgen.nim b/nimgen.nim
index 2bb3e16..f4631c3 100644
--- a/nimgen.nim
+++ b/nimgen.nim
@@ -493,10 +493,13 @@ proc c2nim(fl, outfile: string, c2nimConfig: c2nimConfigObj) =
passC = "import ospaths, strutils\n"
for inc in gIncludes:
- passC &= (
- """{.passC: "-I\"" & currentSourcePath().splitPath().head & "$#\"".}""" %
- inc.relativePath()
- ) & "\n"
+ if inc.isAbsolute():
+ passC &= ("""{.passC: "-I\"$#\"".}""" % [inc]) & "\n"
+ else:
+ passC &= (
+ """{.passC: "-I\"" & currentSourcePath().splitPath().head & "$#\"".}""" %
+ inc.relativePath()
+ ) & "\n"
for prag in c2nimConfig.pragma:
outpragma &= "{." & prag & ".}\n"
@@ -532,8 +535,11 @@ proc c2nim(fl, outfile: string, c2nimConfig: c2nimConfigObj) =
if outlib != "":
extflags &= " --dynlib:dynlib$#" % fname
else:
- passC &= "const header$# = currentSourcePath().splitPath().head & \"$#\"\n" %
- [fname, file.relativePath()]
+ if file.isAbsolute():
+ passC &= "const header$# = \"$#\"\n" % [fname, file]
+ else:
+ passC &= "const header$# = currentSourcePath().splitPath().head & \"$#\"\n" %
+ [fname, file.relativePath()]
extflags = "--header:header$#" % fname
# Run c2nim on generated file