Merge pull request #4352 from jyapayne/fix_walkfiles
Fix #4280: os.walkFiles yields directories on Unix systems
This commit is contained in:
commit
494b3b3917
1 changed files with 4 additions and 1 deletions
|
|
@ -815,7 +815,10 @@ iterator walkFiles*(pattern: string): string {.tags: [ReadDirEffect].} =
|
||||||
if res == 0:
|
if res == 0:
|
||||||
for i in 0.. f.gl_pathc - 1:
|
for i in 0.. f.gl_pathc - 1:
|
||||||
assert(f.gl_pathv[i] != nil)
|
assert(f.gl_pathv[i] != nil)
|
||||||
yield $f.gl_pathv[i]
|
let path = $f.gl_pathv[i]
|
||||||
|
# Make sure it's a file and not a directory
|
||||||
|
if fileExists(path):
|
||||||
|
yield path
|
||||||
|
|
||||||
type
|
type
|
||||||
PathComponent* = enum ## Enumeration specifying a path component.
|
PathComponent* = enum ## Enumeration specifying a path component.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue