Import ospaths instead of include (#5233)

* Import ospaths instead of include
* searchExtPos made public
This commit is contained in:
Yuriy Glukhov 2017-01-18 21:17:53 +02:00 • committed by Andreas Rumpf
commit fe0291f127
2 changed files with 14 additions and 12 deletions

View file

@ -26,7 +26,8 @@ elif defined(posix):
else:
{.error: "OS module not ported to your operating system!".}
include ospaths
import ospaths
export ospaths
when defined(posix):
when NoFakeVars:
@ -848,12 +849,12 @@ template walkCommon(pattern: string, filter) =
res = findFirstFile(pattern, f)
if res != -1:
defer: findClose(res)
let dotPos = searchExtPos(pattern)
while true:
if not skipFindData(f) and filter(f):
# Windows bug/gotcha: 't*.nim' matches 'tfoo.nims' -.- so we check
# that the file extensions have the same length ...
let ff = getFilename(f)
let dotPos = searchExtPos(pattern)
let idx = ff.len - pattern.len + dotPos
if dotPos < 0 or idx >= ff.len or ff[idx] == '.' or
pattern[dotPos+1] == '*':
@ -1109,7 +1110,7 @@ proc createDir*(dir: string) {.rtl, extern: "nos$1",
## fail if the directory already exists because for most usages this does not
## indicate an error.
var omitNext = false
when doslike:
when doslikeFileSystem:
omitNext = isAbsolute(dir)
for i in 1.. dir.len-1:
if dir[i] in {DirSep, AltSep}: