Fix #4280: os.walkFiles yields directories on Unix systems
Files were not properly checked to actually be files after globbing.
This commit is contained in:
parent
9837b12ee6
commit
b5f1a82285
1 changed files with 4 additions and 1 deletions
|
|
@ -815,7 +815,10 @@ iterator walkFiles*(pattern: string): string {.tags: [ReadDirEffect].} =
|
|||
if res == 0:
|
||||
for i in 0.. f.gl_pathc - 1:
|
||||
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
|
||||
PathComponent* = enum ## Enumeration specifying a path component.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue