From d1813414e3d90b09def545aa9183d63eefff12a4 Mon Sep 17 00:00:00 2001 From: Joey Yakimowich-Payne Date: Sun, 8 Jul 2018 22:56:36 +0900 Subject: [PATCH] Add check for absolute directories --- nimgen.nim | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/nimgen.nim b/nimgen.nim index be066de..63e54d9 100644 --- a/nimgen.nim +++ b/nimgen.nim @@ -585,11 +585,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"