File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
src/pylib/Lib/os_impl/posix_like Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,11 @@ iterator items*[T](scandirIter: ScandirIterator[T]): DirEntry[T] =
44
44
for i in scandirIter.iter():
45
45
yield i
46
46
47
+ template enter*(self: ScandirIterator): ScandirIterator = self
48
+ template exit*(self: ScandirIterator; args: varargs [untyped ]) =
49
+ bind close
50
+ self.close()
51
+
47
52
using self: DirEntry
48
53
49
54
when InJs:
@@ -64,10 +69,11 @@ else:
64
69
func repr*(self): string =
65
70
"<DirEntry " & self.name.repr & '>'
66
71
67
- func stat*(self): stat_result =
72
+ proc stat*(self; follow_symlinks=true): stat_result =
73
+ static : assert not compiles(self.dir_fd) # currently impl assumes no dir_fd
68
74
if self.stat_res != nil:
69
75
return self.stat_res[]
70
- result = stat(self.path)
76
+ result = stat(self.path, follow_symlinks=follow_symlinks )
71
77
new self.stat_res
72
78
self.stat_res[] = result
73
79
You can’t perform that action at this time.
0 commit comments