aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Yakimowich-Payne <jyapayne@gmail.com>2018-07-08 22:56:36 +0900
committerJoey Yakimowich-Payne <jyapayne@gmail.com>2018-07-08 22:56:36 +0900
commit512cdd3a9f64d2be1a6fd338fe6d7fddeceaebae (patch)
tree75abed04d5557e8fae8dc132f9b007378c111556
parent15d417d2c5f6b3a5d25aaa5506a60201dc4f36cc (diff)
downloadnimgen-512cdd3a9f64d2be1a6fd338fe6d7fddeceaebae.tar.gz
nimgen-512cdd3a9f64d2be1a6fd338fe6d7fddeceaebae.zip
Add check for absolute directories
-rw-r--r--nimgen.nim13
1 files changed, 8 insertions, 5 deletions
diff --git a/nimgen.nim b/nimgen.nim
index a432ab6..75461bc 100644
--- a/nimgen.nim
+++ b/nimgen.nim
@@ -491,11 +491,14 @@ proc c2nim(fl, outfile: string, c2nimConfig: c2nimConfigObj) =
passC &= "import ospaths\n"
for inc in gIncludes:
- let relativeInc = inc.replace(gOutput, "")
- passC &= (
- """{.passC: "-I\"" & currentSourcePath().splitPath().head & "/$#\"".}""" %
- [relativeInc]
- ) & "\n"
+ if inc.isAbsolute:
+ passC &= ("""{.passC: "-I\"$#\"".}""" % [inc]) & "\n"
+ else:
+ let relativeInc = inc.replace(gOutput, "")
+ passC &= (
+ """{.passC: "-I\"" & currentSourcePath().splitPath().head & "/$#\"".}""" %
+ [relativeInc]
+ ) & "\n"
for prag in c2nimConfig.pragma:
outpragma &= "{." & prag & ".}\n"