nim-iterutils icon indicating copy to clipboard operation
nim-iterutils copied to clipboard

Concat and walkDir don't work together.

Open treeform opened this issue 4 years ago • 1 comments

Concat works for other iterators like in your tests, but does not work with walkDir, I don't understand why:

import os, iterutils

# works
for n in concat(toIter(1..4), toIter(20..23)):
  echo n

# does not work
for f in concat(walkDir("."), walkDir(".")):
  echo f

I don't understand the error either:

C:\p\try\iterwalkdir.nim(6, 31) Error: attempting to call routine: 'walkDir'
  found 'os.walkDir(dir: string, relative: bool, checkDir: bool) [declared in C:\Users\me\.choosenim\toolchains\nim-1.4.6\lib\pure\os.nim(2076, 10)]' of kind 'iterator

Maybe you can help?

treeform avatar Jun 25 '21 17:06 treeform

Looks like walkDir changed its definition and you also need to pass the parameters relative & checkDir. Maybe like this:

for f in concat(walkDir(".", true, false), walkDir(".", true, false)):
  echo f

def- avatar Jun 25 '21 20:06 def-