aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgenotrance <dev@genotrance.com>2018-07-16 08:48:59 -0500
committerGitHub <noreply@github.com>2018-07-16 08:48:59 -0500
commitaad005e0b123fd2ba08df058ba6a998cd68eea08 (patch)
tree9119a99713ced2bebb2931b8c7e816460fbc41da
parent96949bf15009868b4ece1bd7d3ece9a8c454fddb (diff)
parent0b2fb6cfbc24041feb92221205623e0d579f0247 (diff)
downloadnimgen-aad005e0b123fd2ba08df058ba6a998cd68eea08.tar.gz
nimgen-aad005e0b123fd2ba08df058ba6a998cd68eea08.zip
Merge pull request #30 from jyapayne/fix_cross_compile_sourcepath
Fix issue with sourcepath building switch on Windows
-rw-r--r--src/nimgen/c2nim.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nimgen/c2nim.nim b/src/nimgen/c2nim.nim
index bca56d1..f171e8d 100644
--- a/src/nimgen/c2nim.nim
+++ b/src/nimgen/c2nim.nim
@@ -36,12 +36,14 @@ proc c2nim*(fl, outfile: string, c2nimConfig: c2nimConfigObj) =
passC = "import ospaths, strutils\n"
+ passC &= """const sourcePath = currentSourcePath().split({'\\', '/'})[0..^2].join("/")""" & "\n"
+
for inc in gIncludes:
if inc.isAbsolute():
passC &= ("""{.passC: "-I\"$#\"".}""" % [inc.sanitizePath()]) & "\n"
else:
passC &= (
- """{.passC: "-I\"" & currentSourcePath().splitPath().head & "$#\"".}""" %
+ """{.passC: "-I\"" & sourcePath & "$#\"".}""" %
inc.relativePath()
) & "\n"
@@ -82,7 +84,7 @@ proc c2nim*(fl, outfile: string, c2nimConfig: c2nimConfigObj) =
if file.isAbsolute():
passC &= "const header$# = \"$#\"\n" % [fname, file]
else:
- passC &= "const header$# = currentSourcePath().splitPath().head & \"$#\"\n" %
+ passC &= "const header$# = sourcePath & \"$#\"\n" %
[fname, file.relativePath()]
extflags = "--header:header$#" % fname
# Run c2nim on generated file