From 1114b2336e917d883c30f89cd63ba94050001b2d Mon Sep 17 00:00:00 2001 From: Nicolas Thierry <45313578+Captainfl4me@users.noreply.github.com> Date: Sat, 15 Feb 2025 21:19:11 +0100 Subject: fix(fs): fall back to `fs_stat` if entry type is not returned by `fs_readdir` (#1783) Co-authored-by: William Boman --- lua/mason-core/fs.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lua/mason-core') 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 -- cgit v1.2.3-70-g09d2