chore: remove deprecated scandir

This commit is contained in:
Folke Lemaitre 2022-11-26 13:57:05 +01:00
parent 7933ae11c4
commit 359c260911
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 0 additions and 17 deletions

View File

@ -107,23 +107,6 @@ function M.very_lazy()
end end
---@alias FileType "file"|"directory"|"link" ---@alias FileType "file"|"directory"|"link"
---@alias DirEntry {name: string, path: string, type: FileType}[]
---@param path string
---@param fn fun(path: string, name:string, type:FileType)
function M.scandir(path, fn)
local dir = vim.loop.fs_opendir(path, nil, 100)
if dir then
local entries = vim.loop.fs_readdir(dir) --[[@as DirEntry[]]
while entries do
for _, entry in ipairs(entries) do
entry.path = path .. "/" .. entry.name
fn(path .. "/" .. entry.name, entry.name, entry.type)
end
entries = vim.loop.fs_readdir(dir)
end
vim.loop.fs_closedir(dir)
end
end
---@param path string ---@param path string
---@param fn fun(path: string, name:string, type:FileType) ---@param fn fun(path: string, name:string, type:FileType)
function M.ls(path, fn) function M.ls(path, fn)