From 61fe65ecb5cd63b65d0f1b038244a68c8fe6baf1 Mon Sep 17 00:00:00 2001 From: SalOrak <99770300+SalOrak@users.noreply.github.com> Date: Sat, 9 Mar 2024 00:34:33 +0100 Subject: [PATCH] feat(#560): scandir adds link entry if it is a directory. scandir main function (sync only) adds symlinks directories when found. It does not apply any recursion whatsoever. --- lua/plenary/scandir.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/plenary/scandir.lua b/lua/plenary/scandir.lua index fd35fd9f..4d201831 100644 --- a/lua/plenary/scandir.lua +++ b/lua/plenary/scandir.lua @@ -100,6 +100,13 @@ local gen_search_pat = function(pattern) end local process_item = function(opts, name, typ, current_dir, next_dir, bp, data, giti, msp) + if typ == "link" and opts.links then + local entry = uv.fs_readlink(current_dir .. "/" .. name) + local ln_type = uv.fs_stat(entry).type + if ln_type == "directory" then + table.insert(data, entry) + end + end if opts.hidden or name:sub(1, 1) ~= "." then if typ == "directory" then local entry = current_dir .. os_sep .. name