summaryrefslogtreecommitdiff
path: root/std/fs/walk.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/fs/walk.ts')
-rw-r--r--std/fs/walk.ts17
1 files changed, 8 insertions, 9 deletions
diff --git a/std/fs/walk.ts b/std/fs/walk.ts
index 47e7e7afa..4ce564435 100644
--- a/std/fs/walk.ts
+++ b/std/fs/walk.ts
@@ -106,18 +106,17 @@ export async function* walk(
return;
}
for await (const entry of Deno.readDir(root)) {
+ assert(entry.name != null);
+ let path = join(root, entry.name);
+
if (entry.isSymlink) {
if (followSymlinks) {
- // TODO(ry) Re-enable followSymlinks.
- throw new Error("unimplemented");
+ path = await Deno.realPath(path);
} else {
continue;
}
}
- assert(entry.name != null);
- const path = join(root, entry.name);
-
if (entry.isFile) {
if (includeFiles && include(path, exts, match, skip)) {
yield { path, ...entry };
@@ -159,17 +158,17 @@ export function* walkSync(
return;
}
for (const entry of Deno.readDirSync(root)) {
+ assert(entry.name != null);
+ let path = join(root, entry.name);
+
if (entry.isSymlink) {
if (followSymlinks) {
- throw new Error("unimplemented");
+ path = Deno.realPathSync(path);
} else {
continue;
}
}
- assert(entry.name != null);
- const path = join(root, entry.name);
-
if (entry.isFile) {
if (includeFiles && include(path, exts, match, skip)) {
yield { path, ...entry };