1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: rewrite os.walk and os.walk_with_context to use iteration, instead of recursion

This commit is contained in:
Delyan Angelov
2022-08-22 17:10:46 +03:00
parent 21917f5b00
commit a689641c1b
3 changed files with 96 additions and 24 deletions

View File

@ -29,6 +29,24 @@ pub fn is_link(path string) bool {
return res
}
struct PathKind {
is_dir bool
is_link bool
}
fn kind_of_existing_path(path string) PathKind {
is_link := false
is_dir := false
$if js_node {
#is_link.val = $fs.existsSync(path.str) && $fs.lstatSync(path.str).isSymbolicLink()
#is_dir.val = $fs.existsSync(path,str) && $fs.lstatSync(path.str).isDirectory()
}
return PathKind{
is_dir: is_dir
is_link: is_link
}
}
pub fn exists(path string) bool {
res := false
$if js_node {