aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorNicolas Thierry <45313578+Captainfl4me@users.noreply.github.com>2025-02-15 21:19:11 +0100
committerGitHub <noreply@github.com>2025-02-15 21:19:11 +0100
commit1114b2336e917d883c30f89cd63ba94050001b2d (patch)
tree11617bbf860ca2f9b5927e78e68af8e51f4a6711 /lua
parentfix: avoid calling vim.fn in fast event (#1878) (diff)
downloadmason-1114b2336e917d883c30f89cd63ba94050001b2d.tar
mason-1114b2336e917d883c30f89cd63ba94050001b2d.tar.gz
mason-1114b2336e917d883c30f89cd63ba94050001b2d.tar.bz2
mason-1114b2336e917d883c30f89cd63ba94050001b2d.tar.lz
mason-1114b2336e917d883c30f89cd63ba94050001b2d.tar.xz
mason-1114b2336e917d883c30f89cd63ba94050001b2d.tar.zst
mason-1114b2336e917d883c30f89cd63ba94050001b2d.zip
fix(fs): fall back to `fs_stat` if entry type is not returned by `fs_readdir` (#1783)
Co-authored-by: William Boman <william@redwill.se>
Diffstat (limited to 'lua')
-rw-r--r--lua/mason-core/fs.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/lua/mason-core/fs.lua b/lua/mason-core/fs.lua
index 203c96d7..7c4ee5d0 100644
--- a/lua/mason-core/fs.lua
+++ b/lua/mason-core/fs.lua
@@ -134,6 +134,13 @@ local function make_module(uv)
log.trace("fs: fs_readdir", path, entries)
if entries and #entries > 0 then
for i = 1, #entries do
+ if entries[i].name and not entries[i].type then
+ -- See https://github.com/luvit/luv/issues/660
+ local full_path = Path.concat { path, entries[i].name }
+ log.trace("fs: fs_readdir falling back to fs_stat to find type", full_path)
+ local stat = uv.fs_stat(full_path)
+ entries[i].type = stat.type
+ end
all_entries[#all_entries + 1] = entries[i]
end
else