Fall back to lstat() calls on unsupported filesystems
This commit is contained in:
parent
18dd5e1965
commit
34d87c105c
1 changed files with 10 additions and 6 deletions
|
|
@ -1300,13 +1300,17 @@ iterator walkDir*(dir: string): tuple[kind: PathComponent, path: string] {.
|
||||||
var s: TStat
|
var s: TStat
|
||||||
y = dir / y
|
y = dir / y
|
||||||
var k = pcFile
|
var k = pcFile
|
||||||
|
|
||||||
when defined(linux) or defined(macosx):
|
when defined(linux) or defined(macosx):
|
||||||
if x.d_type == DT_DIR: k = pcDir
|
if x.d_type != DT_UNKNOWN:
|
||||||
if x.d_type == DT_LNK: k = succ(k)
|
if x.d_type == DT_DIR: k = pcDir
|
||||||
else:
|
if x.d_type == DT_LNK: k = succ(k)
|
||||||
if lstat(y, s) < 0'i32: break
|
yield (k, y)
|
||||||
if S_ISDIR(s.st_mode): k = pcDir
|
continue
|
||||||
if S_ISLNK(s.st_mode): k = succ(k)
|
|
||||||
|
if lstat(y, s) < 0'i32: break
|
||||||
|
if S_ISDIR(s.st_mode): k = pcDir
|
||||||
|
if S_ISLNK(s.st_mode): k = succ(k)
|
||||||
yield (k, y)
|
yield (k, y)
|
||||||
discard closedir(d)
|
discard closedir(d)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue