Fix #20628 for Windows (#20667)

* Fix #20628 for Windows

* Move isRegular - !isSpecial and onlyRegular - skipSpecial

* Forgot to change it in 1 more place
This commit is contained in:
Andrey Makarov 2022-10-28 11:01:28 +03:00 • committed by GitHub
commit 779b1cc5be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 41 additions and 38 deletions

View file

@ -69,7 +69,7 @@ proc moveDir*(source, dest: Path) {.inline, tags: [ReadIOEffect, WriteIOEffect].
moveDir(source.string, dest.string)
iterator walkDir*(dir: Path; relative = false, checkDir = false,
onlyRegular = false):
skipSpecial = false):
tuple[kind: PathComponent, path: Path] {.tags: [ReadDirEffect].} =
## Walks over the directory `dir` and yields for each directory or file in
## `dir`. The component type and full path for each item are returned.
@ -80,20 +80,20 @@ iterator walkDir*(dir: Path; relative = false, checkDir = false,
## otherwise the full path is returned.
## * If `checkDir` is true, `OSError` is raised when `dir`
## doesn't exist.
## * If `onlyRegular` is true, then (besides all directories) only *regular*
## * If `skipSpecial` is true, then (besides all directories) only *regular*
## files (**without** special "file" objects like FIFOs, device files,
## etc) will be yielded on Unix.
for (k, p) in walkDir(dir.string, relative, checkDir, onlyRegular):
for (k, p) in walkDir(dir.string, relative, checkDir, skipSpecial):
yield (k, Path(p))
iterator walkDirRec*(dir: Path,
yieldFilter = {pcFile}, followFilter = {pcDir},
relative = false, checkDir = false, onlyRegular = false):
relative = false, checkDir = false, skipSpecial = false):
Path {.tags: [ReadDirEffect].} =
## Recursively walks over the directory `dir` and yields for each file
## or directory in `dir`.
##
## Options `relative`, `checkdir`, `onlyRegular` are explained in
## Options `relative`, `checkdir`, `skipSpecial` are explained in
## [walkDir iterator] description.
##
## .. warning:: Modifying the directory structure while the iterator
@ -121,7 +121,7 @@ iterator walkDirRec*(dir: Path,
## See also:
## * `walkDir iterator`_
for p in walkDirRec(dir.string, yieldFilter, followFilter, relative,
checkDir, onlyRegular):
checkDir, skipSpecial):
yield Path(p)
proc setCurrentDir*(newDir: Path) {.inline, tags: [].} =