From b5f1a82285daa48ed4cdb900ce865a61a9d7f64e Mon Sep 17 00:00:00 2001 From: Joey Payne Date: Thu, 16 Jun 2016 14:24:38 -0600 Subject: Fix #4280: os.walkFiles yields directories on Unix systems Files were not properly checked to actually be files after globbing. --- lib/pure/os.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/pure') diff --git a/lib/pure/os.nim b/lib/pure/os.nim index 2b1cf7409..668793c20 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -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. -- cgit 1.4.1-2-gfad0