Skip to content

Commit a17e87b

Browse files
authored
fix #11458 oswalkdir (#13689)
* fix #11458 oswalkdir * changelog
1 parent ba6e7c6 commit a17e87b

File tree

2 files changed

+5
-27
lines changed

2 files changed

+5
-27
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ echo f
135135
- `parseutils.parseUntil` has now a different behaviour if the `until` parameter is
136136
empty. This was required for intuitive behaviour of the strscans module
137137
(see bug #13605).
138+
- `std/oswalkdir` was buggy, it's now deprecated and reuses `std/os` procs
138139

139140

140141
## Language additions

lib/pure/oswalkdir.nim

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,7 @@
77
# distribution, for details about the copyright.
88
#
99

10-
## Compile-time only version for walkDir if you need it at compile-time
11-
## for JavaScript.
12-
13-
type
14-
PathComponent* = enum ## Enumeration specifying a path component.
15-
pcFile, ## path refers to a file
16-
pcLinkToFile, ## path refers to a symbolic link to a file
17-
pcDir, ## path refers to a directory
18-
pcLinkToDir ## path refers to a symbolic link to a directory
19-
20-
proc staticWalkDir(dir: string; relative: bool): seq[
21-
tuple[kind: PathComponent; path: string]] =
22-
discard
23-
24-
iterator walkDir*(dir: string; relative = false): tuple[kind: PathComponent;
25-
path: string] =
26-
for k, v in items(staticWalkDir(dir, relative)):
27-
yield (k, v)
28-
29-
iterator walkDirRec*(dir: string; filter = {pcFile, pcDir}): string =
30-
var stack = @[dir]
31-
while stack.len > 0:
32-
for k, p in walkDir(stack.pop()):
33-
if k in filter:
34-
case k
35-
of pcFile, pcLinkToFile: yield p
36-
of pcDir, pcLinkToDir: stack.add(p)
10+
## This module is deprecated, ``import os`` instead.
11+
{.deprecated: "import os.nim instead".}
12+
import os
13+
export PathComponent, walkDir, walkDirRec

0 commit comments

Comments
 (0)