[backport] run nimpretty on os-related stuff
This commit is contained in:
parent
dcf3181bd1
commit
34d0be2ec1
10 changed files with 191 additions and 182 deletions
|
|
@ -11,24 +11,25 @@
|
|||
## for JavaScript.
|
||||
|
||||
type
|
||||
PathComponent* = enum ## Enumeration specifying a path component.
|
||||
pcFile, ## path refers to a file
|
||||
pcLinkToFile, ## path refers to a symbolic link to a file
|
||||
pcDir, ## path refers to a directory
|
||||
pcLinkToDir ## path refers to a symbolic link to a directory
|
||||
PathComponent* = enum ## Enumeration specifying a path component.
|
||||
pcFile, ## path refers to a file
|
||||
pcLinkToFile, ## path refers to a symbolic link to a file
|
||||
pcDir, ## path refers to a directory
|
||||
pcLinkToDir ## path refers to a symbolic link to a directory
|
||||
|
||||
proc staticWalkDir(dir: string; relative: bool): seq[
|
||||
tuple[kind: PathComponent, path: string]] =
|
||||
tuple[kind: PathComponent; path: string]] =
|
||||
discard
|
||||
|
||||
iterator walkDir*(dir: string; relative=false): tuple[kind: PathComponent, path: string] =
|
||||
iterator walkDir*(dir: string; relative = false): tuple[kind: PathComponent;
|
||||
path: string] =
|
||||
for k, v in items(staticWalkDir(dir, relative)):
|
||||
yield (k, v)
|
||||
|
||||
iterator walkDirRec*(dir: string, filter={pcFile, pcDir}): string =
|
||||
iterator walkDirRec*(dir: string; filter = {pcFile, pcDir}): string =
|
||||
var stack = @[dir]
|
||||
while stack.len > 0:
|
||||
for k,p in walkDir(stack.pop()):
|
||||
for k, p in walkDir(stack.pop()):
|
||||
if k in filter:
|
||||
case k
|
||||
of pcFile, pcLinkToFile: yield p
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue