aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/nvim/dir.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2026-07-01 07:18:08 -0400
committerGitHub <noreply@github.com>2026-07-01 07:18:08 -0400
commitd253acca35205a2277af8fae5cf4a3ea3e1bb302 (patch)
tree85cb5f97c8bda004eb19b1dd6972b6255100eeda /runtime/lua/nvim/dir.lua
parent0d81f257afd24373144873e8f030bf929c1900e2 (diff)
parent1035a9fb5df1ed7c5cab99fa4c0686c2c9ef0e37 (diff)
downloadrneovim-d253acca35205a2277af8fae5cf4a3ea3e1bb302.tar.gz
rneovim-d253acca35205a2277af8fae5cf4a3ea3e1bb302.tar.bz2
rneovim-d253acca35205a2277af8fae5cf4a3ea3e1bb302.zip
Merge #40114 feat(vim.fs): dir(), find() error-reporting
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