aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/nvim/dir.lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/nvim/dir.lua')
-rw-r--r--runtime/lua/nvim/dir.lua15
1 files changed, 5 insertions, 10 deletions
diff --git a/runtime/lua/nvim/dir.lua b/runtime/lua/nvim/dir.lua
index bd00b95cbe..cdc8713c77 100644
--- a/runtime/lua/nvim/dir.lua
+++ b/runtime/lua/nvim/dir.lua
@@ -3,7 +3,6 @@
local api = vim.api
local fs = vim.fs
-local uv = vim.uv
local M = {}
@@ -50,17 +49,13 @@ end
---@param dir string
---@return boolean
local function render(buf, dir)
- -- TODO(#39878): drop this scandir probe once vim.fs.dir() can report
- -- traversal errors.
- local handle, err = uv.fs_scandir(dir)
- if not handle then
- vim.notify('dir: ' .. (err or ('cannot read directory: ' .. dir)), vim.log.levels.ERROR)
- return false
- end
-
---@type { name: string, dir: boolean }[]
local items = {}
- for name, type in fs.dir(dir) do
+ for name, type, err in fs.dir(dir, { err = true }) do
+ if err then
+ vim.notify('dir: ' .. err, vim.log.levels.ERROR)
+ return false
+ end
if type == 'link' and vim.fn.isdirectory(fs.joinpath(dir, name)) == 1 then
type = 'directory'
end