Skip to content

Commit

Permalink
the same for wsInterrupted
Browse files Browse the repository at this point in the history
  • Loading branch information
a-mr committed Feb 4, 2020
1 parent 2abbecb commit 5b554d8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/pure/os.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2177,6 +2177,7 @@ iterator tryWalkDir*(dir: string, relative=false): WalkStep {.

var step: WalkStep
var skip = false
let outDir = if relative: "." else: dir
proc sOpenDir(s: OpenDirStatus, path: string): WalkStep =
let code = if s == odOpenOk: OSErrorCode(0) else: osLastError()
result = WalkStep(kind: wsOpenDir, openStatus: s, code: code, path: path)
Expand Down Expand Up @@ -2209,7 +2210,7 @@ iterator tryWalkDir*(dir: string, relative=false): WalkStep {.
of ERROR_ACCESS_DENIED: odAccessDenied
else: odUnknownError
else: odOpenOk
step = sOpenDir(status, if relative: "." else: dir)
step = sOpenDir(status, outDir)

var firstStep = true
while true:
Expand All @@ -2226,7 +2227,7 @@ iterator tryWalkDir*(dir: string, relative=false): WalkStep {.
break # normal end, yielding nothing
else:
skip = false
step = sGetError(wsInterrupted, dir)
step = sGetError(wsInterrupted, outDir)
continue
skip = skipFindData(f)
if not skip:
Expand Down Expand Up @@ -2280,7 +2281,7 @@ iterator tryWalkDir*(dir: string, relative=false): WalkStep {.
elif errno == EACCES: odAccessDenied
else: odUnknownError
else: odOpenOk
step = sOpenDir(status, if relative: "." else: dir)
step = sOpenDir(status, outDir)

while true:
if not skip:
Expand All @@ -2296,7 +2297,7 @@ iterator tryWalkDir*(dir: string, relative=false): WalkStep {.
break # normal end, yielding nothing
else:
skip = false
step = sGetError(wsInterrupted, dir)
step = sGetError(wsInterrupted, outDir)
continue
when defined(nimNoArrayToCstringConversion):
var y = $cstring(addr x.d_name)
Expand Down

0 comments on commit 5b554d8

Please sign in to comment.