summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2016-06-17 12:29:17 +0100
committerGitHub <noreply@github.com>2016-06-17 12:29:17 +0100
commit494b3b39177749a4e6b7c52e463a2a219ab46542 (patch)
tree6521e46dadeb25a7770a547b55e349adce3ea7b0 /lib/pure
parent99abfcef35ee8cc819fcb3f63d48d8e11dd116d9 (diff)
parentb5f1a82285daa48ed4cdb900ce865a61a9d7f64e (diff)
downloadNim-494b3b39177749a4e6b7c52e463a2a219ab46542.tar.gz
Merge pull request #4352 from jyapayne/fix_walkfiles
Fix #4280: os.walkFiles yields directories on Unix systems
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/os.nim5
1 files changed, 4 insertions, 1 deletions
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.