GIven this test, it looks like dir_ls intentionally does not follow symbolic links.
|
it("Does not follow symbolic links", { |
I think it would be useful to list the contents of symbolically-linked directories. Would you consider an option to support this? For example, I'd like to see that the linked directory contains files A and B in the reprex below.
library(fs)
# modfied from example script at https://fs.r-lib.org/reference/copy.html
# make dir foo with multiple files
foo_dir <- dir_create(tempdir(), "foo")
file_create(foo_dir, c("A", "B"))
dir_ls(foo_dir)
#> /var/folders/wg/tq2qzp8s4yq1vhh2x_ldwc0c0000gn/T/Rtmp1Po6JD/foo/A
#> /var/folders/wg/tq2qzp8s4yq1vhh2x_ldwc0c0000gn/T/Rtmp1Po6JD/foo/B
# make dir bar with symbolic link to dir foo
bar_dir <- dir_create(tempdir(), "bar")
link_create(
path = foo_dir,
new_path = path(bar_dir, "loo")
)
# list bar contents
dir_ls(bar_dir, recurse = TRUE)
#> /var/folders/wg/tq2qzp8s4yq1vhh2x_ldwc0c0000gn/T/Rtmp1Po6JD/bar/loo
Created on 2026-06-12 with reprex v2.1.1
GIven this test, it looks like
dir_lsintentionally does not follow symbolic links.fs/tests/testthat/test-list.R
Line 23 in 81211aa
I think it would be useful to list the contents of symbolically-linked directories. Would you consider an option to support this? For example, I'd like to see that the linked directory contains files A and B in the reprex below.
Created on 2026-06-12 with reprex v2.1.1