summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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.