Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
This commit is contained in:
parent
2365b5250e
commit
792a03b756
1 changed files with 6 additions and 10 deletions
|
|
@ -2266,16 +2266,12 @@ iterator walkDir*(dir: string; relative = false, checkDir = false):
|
||||||
## / fileA2.txt
|
## / fileA2.txt
|
||||||
##
|
##
|
||||||
## and this code:
|
## and this code:
|
||||||
##
|
runnableExamples("-r:off"):
|
||||||
## .. code-block:: Nim
|
import std/[strutils, sugar]
|
||||||
## for kind, path in walkDir("dirA"):
|
# note: order is not guaranteed
|
||||||
## echo(path)
|
# this also works at compile time
|
||||||
##
|
assert collect(for k in walkDir("dirA"): k.path).join(" ") ==
|
||||||
## produce this output (but not necessarily in this order!)::
|
"dirA/dirB dirA/dirC dirA/fileA2.txt dirA/fileA1.txt"
|
||||||
## dirA/dirB
|
|
||||||
## dirA/dirC
|
|
||||||
## dirA/fileA1.txt
|
|
||||||
## dirA/fileA2.txt
|
|
||||||
##
|
##
|
||||||
## See also:
|
## See also:
|
||||||
## * `walkPattern iterator <#walkPattern.i,string>`_
|
## * `walkPattern iterator <#walkPattern.i,string>`_
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue