Fix issue with sourcpath building switch on Windows
This commit is contained in:
parent
96949bf150
commit
0b2fb6cfbc
1 changed files with 4 additions and 2 deletions
|
|
@ -36,12 +36,14 @@ proc c2nim*(fl, outfile: string, c2nimConfig: c2nimConfigObj) =
|
||||||
|
|
||||||
passC = "import ospaths, strutils\n"
|
passC = "import ospaths, strutils\n"
|
||||||
|
|
||||||
|
passC &= """const sourcePath = currentSourcePath().split({'\\', '/'})[0..^2].join("/")""" & "\n"
|
||||||
|
|
||||||
for inc in gIncludes:
|
for inc in gIncludes:
|
||||||
if inc.isAbsolute():
|
if inc.isAbsolute():
|
||||||
passC &= ("""{.passC: "-I\"$#\"".}""" % [inc.sanitizePath()]) & "\n"
|
passC &= ("""{.passC: "-I\"$#\"".}""" % [inc.sanitizePath()]) & "\n"
|
||||||
else:
|
else:
|
||||||
passC &= (
|
passC &= (
|
||||||
"""{.passC: "-I\"" & currentSourcePath().splitPath().head & "$#\"".}""" %
|
"""{.passC: "-I\"" & sourcePath & "$#\"".}""" %
|
||||||
inc.relativePath()
|
inc.relativePath()
|
||||||
) & "\n"
|
) & "\n"
|
||||||
|
|
||||||
|
|
@ -82,7 +84,7 @@ proc c2nim*(fl, outfile: string, c2nimConfig: c2nimConfigObj) =
|
||||||
if file.isAbsolute():
|
if file.isAbsolute():
|
||||||
passC &= "const header$# = \"$#\"\n" % [fname, file]
|
passC &= "const header$# = \"$#\"\n" % [fname, file]
|
||||||
else:
|
else:
|
||||||
passC &= "const header$# = currentSourcePath().splitPath().head & \"$#\"\n" %
|
passC &= "const header$# = sourcePath & \"$#\"\n" %
|
||||||
[fname, file.relativePath()]
|
[fname, file.relativePath()]
|
||||||
extflags = "--header:header$#" % fname
|
extflags = "--header:header$#" % fname
|
||||||
# Run c2nim on generated file
|
# Run c2nim on generated file
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue