Put sanitizePath in search()

This commit is contained in:
Joey Yakimowich-Payne 2018-07-18 07:52:45 +09:00
commit 6343567a91
4 changed files with 5 additions and 5 deletions

View file

@ -6,7 +6,7 @@ template relativePath(path: untyped): untyped =
path.multiReplace([(gOutput, ""), ("\\", "/"), ("//", "/")]) path.multiReplace([(gOutput, ""), ("\\", "/"), ("//", "/")])
proc c2nim*(fl, outfile: string, c2nimConfig: c2nimConfigObj) = proc c2nim*(fl, outfile: string, c2nimConfig: c2nimConfigObj) =
var file = search(fl).sanitizePath var file = search(fl)
if file.len() == 0: if file.len() == 0:
return return

View file

@ -118,7 +118,7 @@ proc runPreprocess*(file, ppflags, flags: string, inline: bool): string =
var var
rdata: Rope rdata: Rope
start = false start = false
sfile = file.replace("\\", "/") sfile = file.sanitizePath
if inline: if inline:
sfile = sfile.parentDir() sfile = sfile.parentDir()

View file

@ -1,6 +1,6 @@
import os, ospaths, pegs, regex, strutils, tables import os, ospaths, pegs, regex, strutils, tables
import globals import globals, external
# ### # ###
# File loction # File loction
@ -44,7 +44,7 @@ proc search*(file: string): string =
quit(1) quit(1)
# Only keep relative directory # Only keep relative directory
return result.multiReplace([("\\", $DirSep), ("//", $DirSep), (gProjectDir & $DirSep, "")]) return result.sanitizePath.replace(gProjectDir & "/", "")
proc rename*(file: string, renfile: string) = proc rename*(file: string, renfile: string) =
if file.splitFile().ext == ".nim": if file.splitFile().ext == ".nim":

View file

@ -25,7 +25,7 @@ proc getKey(ukey: string): tuple[key: string, val: bool] =
proc runFile*(file: string, cfgin: OrderedTableRef = newOrderedTable[string, string]()) = proc runFile*(file: string, cfgin: OrderedTableRef = newOrderedTable[string, string]()) =
var var
cfg = cfgin cfg = cfgin
sfile = search(file).sanitizePath sfile = search(file)
if sfile in gDoneRecursive: if sfile in gDoneRecursive:
return return