aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgenotrance <dev@genotrance.com>2018-07-18 09:28:10 -0500
committerGitHub <noreply@github.com>2018-07-18 09:28:10 -0500
commitdc9943a22c9c8f6a5a6a92f0055e1de4dfaf87d2 (patch)
tree18023818645da8caa49db52f638e6f1c61132531
parentaad005e0b123fd2ba08df058ba6a998cd68eea08 (diff)
parentf3c01e53f985a5f479ee4c58c492cc88e6d7af98 (diff)
downloadnimgen-dc9943a22c9c8f6a5a6a92f0055e1de4dfaf87d2.tar.gz
nimgen-dc9943a22c9c8f6a5a6a92f0055e1de4dfaf87d2.zip
Merge pull request #31 from jyapayne/fix_another_issue
Fix windows not processing headers
-rw-r--r--src/nimgen/external.nim2
-rw-r--r--src/nimgen/file.nim4
-rw-r--r--src/nimgen/runcfg.nim10
3 files changed, 8 insertions, 8 deletions
diff --git a/src/nimgen/external.nim b/src/nimgen/external.nim
index 350c841..c0d5fdc 100644
--- a/src/nimgen/external.nim
+++ b/src/nimgen/external.nim
@@ -118,7 +118,7 @@ proc runPreprocess*(file, ppflags, flags: string, inline: bool): string =
var
rdata: Rope
start = false
- sfile = file.replace("\\", "/")
+ sfile = file.sanitizePath
if inline:
sfile = sfile.parentDir()
diff --git a/src/nimgen/file.nim b/src/nimgen/file.nim
index d78c692..708ae4a 100644
--- a/src/nimgen/file.nim
+++ b/src/nimgen/file.nim
@@ -1,6 +1,6 @@
import os, ospaths, pegs, regex, strutils, tables
-import globals
+import globals, external
# ###
# File loction
@@ -44,7 +44,7 @@ proc search*(file: string): string =
quit(1)
# Only keep relative directory
- return result.multiReplace([("\\", $DirSep), ("//", $DirSep), (gProjectDir & $DirSep, "")])
+ return result.sanitizePath.replace(gProjectDir & "/", "")
proc rename*(file: string, renfile: string) =
if file.splitFile().ext == ".nim":
diff --git a/src/nimgen/runcfg.nim b/src/nimgen/runcfg.nim
index cafb48e..03c0013 100644
--- a/src/nimgen/runcfg.nim
+++ b/src/nimgen/runcfg.nim
@@ -25,7 +25,7 @@ proc getKey(ukey: string): tuple[key: string, val: bool] =
proc runFile*(file: string, cfgin: OrderedTableRef = newOrderedTable[string, string]()) =
var
cfg = cfgin
- sfile = search(file).sanitizePath
+ sfile = search(file)
if sfile in gDoneRecursive:
return
@@ -161,13 +161,13 @@ proc runCfg*(cfg: string) =
echo "Config doesn't exist: " & cfg
quit(1)
- gProjectDir = parentDir(cfg.expandFilename())
+ gProjectDir = parentDir(cfg.expandFilename()).sanitizePath
gConfig = loadConfig(cfg)
if gConfig.hasKey("n.global"):
if gConfig["n.global"].hasKey("output"):
- gOutput = gConfig["n.global"]["output"]
+ gOutput = gConfig["n.global"]["output"].sanitizePath
if dirExists(gOutput):
if "-f" in commandLineParams():
try:
@@ -207,11 +207,11 @@ proc runCfg*(cfg: string) =
if gConfig.hasKey("n.include"):
for inc in gConfig["n.include"].keys():
- gIncludes.add(inc.addEnv())
+ gIncludes.add(inc.addEnv().sanitizePath)
if gConfig.hasKey("n.exclude"):
for excl in gConfig["n.exclude"].keys():
- gExcludes.add(excl.addEnv())
+ gExcludes.add(excl.addEnv().sanitizePath)
if gConfig.hasKey("n.prepare"):
for prep in gConfig["n.prepare"].keys():