diff options
author | Dominik Picheta <dominikpicheta@googlemail.com> | 2016-06-17 12:29:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-17 12:29:17 +0100 |
commit | 494b3b39177749a4e6b7c52e463a2a219ab46542 (patch) | |
tree | 6521e46dadeb25a7770a547b55e349adce3ea7b0 /lib/pure | |
parent | 99abfcef35ee8cc819fcb3f63d48d8e11dd116d9 (diff) | |
parent | b5f1a82285daa48ed4cdb900ce865a61a9d7f64e (diff) | |
download | Nim-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.nim | 5 |
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. |