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:
Joey Payne
2016-06-16 14:24:38 -06:00
parent 9837b12ee6
commit b5f1a82285

View File

@@ -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.