From 9eea0ca51d2980fcc414a5cae254da92bad2ae4a Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 19 Mar 2022 22:49:32 +1100 Subject: [PATCH] #504 determine whether symlinked directories are empty when building (#1089) --- lua/nvim-tree/explorer/node-builders.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/nvim-tree/explorer/node-builders.lua b/lua/nvim-tree/explorer/node-builders.lua index b80c2efc..01ede752 100644 --- a/lua/nvim-tree/explorer/node-builders.lua +++ b/lua/nvim-tree/explorer/node-builders.lua @@ -62,8 +62,10 @@ end function M.link(absolute_path, name, status, parent_ignored) --- I dont know if this is needed, because in my understanding, there isnt hard links in windows, but just to be sure i changed it. local link_to = uv.fs_realpath(absolute_path) - local open, nodes + local open, nodes, has_children if (link_to ~= nil) and uv.fs_stat(link_to).type == "directory" then + local handle = uv.fs_scandir(link_to) + has_children = handle and uv.fs_scandir_next(handle) ~= nil open = false nodes = {} end @@ -77,6 +79,7 @@ function M.link(absolute_path, name, status, parent_ignored) nodes = nodes, open = open, fs_stat = uv.fs_stat(absolute_path), + has_children = has_children, } end