Skip to content

Commit 1114b23

Browse files
fix(fs): fall back to fs_stat if entry type is not returned by fs_readdir (#1783)
Co-authored-by: William Boman <[email protected]>
1 parent 3a444cb commit 1114b23

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lua/mason-core/fs.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ local function make_module(uv)
134134
log.trace("fs: fs_readdir", path, entries)
135135
if entries and #entries > 0 then
136136
for i = 1, #entries do
137+
if entries[i].name and not entries[i].type then
138+
-- See https://github.com/luvit/luv/issues/660
139+
local full_path = Path.concat { path, entries[i].name }
140+
log.trace("fs: fs_readdir falling back to fs_stat to find type", full_path)
141+
local stat = uv.fs_stat(full_path)
142+
entries[i].type = stat.type
143+
end
137144
all_entries[#all_entries + 1] = entries[i]
138145
end
139146
else

0 commit comments

Comments
 (0)