* Revert "revert(#2794): sshfs compatibility (#2920)"
This reverts commit 8405ecfbd6.
Fix for symlinks is simple
* fix sshfs compatibility with symlinks
* add suggestions
* revert variable name change to ease multi-instance feature branch conflicts
---------
Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
parent
59a8a6ae5e
commit
9650e735ba
@ -57,13 +57,18 @@ local function remove_dir(cwd)
|
||||
end
|
||||
|
||||
while true do
|
||||
local name, t = vim.loop.fs_scandir_next(handle)
|
||||
local name, _ = vim.loop.fs_scandir_next(handle)
|
||||
if not name then
|
||||
break
|
||||
end
|
||||
|
||||
local new_cwd = utils.path_join { cwd, name }
|
||||
if t == "directory" then
|
||||
|
||||
-- Type must come from fs_stat and not fs_scandir_next to maintain sshfs compatibility
|
||||
local stat = vim.loop.fs_stat(new_cwd)
|
||||
local type = stat and stat.type or nil
|
||||
|
||||
if type == "directory" then
|
||||
local success = remove_dir(new_cwd)
|
||||
if not success then
|
||||
return false
|
||||
|
||||
@ -125,19 +125,22 @@ function Explorer:reload(node, git_status)
|
||||
})
|
||||
|
||||
while true do
|
||||
local name, t = vim.loop.fs_scandir_next(handle)
|
||||
local name, _ = vim.loop.fs_scandir_next(handle)
|
||||
if not name then
|
||||
break
|
||||
end
|
||||
|
||||
local abs = utils.path_join { cwd, name }
|
||||
---@type uv.fs_stat.result|nil
|
||||
local stat = vim.loop.fs_stat(abs)
|
||||
local stat = vim.loop.fs_lstat(abs)
|
||||
|
||||
local filter_reason = self.filters:should_filter_as_reason(abs, stat, filter_status)
|
||||
if filter_reason == FILTER_REASON.none then
|
||||
remain_childs[abs] = true
|
||||
|
||||
-- Type must come from fs_stat and not fs_scandir_next to maintain sshfs compatibility
|
||||
local t = stat and stat.type or nil
|
||||
|
||||
-- Recreate node if type changes.
|
||||
if nodes_by_path[abs] then
|
||||
local n = nodes_by_path[abs]
|
||||
@ -351,7 +354,7 @@ function Explorer:populate_children(handle, cwd, node, git_status, parent)
|
||||
})
|
||||
|
||||
while true do
|
||||
local name, t = vim.loop.fs_scandir_next(handle)
|
||||
local name, _ = vim.loop.fs_scandir_next(handle)
|
||||
if not name then
|
||||
break
|
||||
end
|
||||
@ -362,9 +365,11 @@ function Explorer:populate_children(handle, cwd, node, git_status, parent)
|
||||
local profile = log.profile_start("populate_children %s", abs)
|
||||
|
||||
---@type uv.fs_stat.result|nil
|
||||
local stat = vim.loop.fs_stat(abs)
|
||||
local stat = vim.loop.fs_lstat(abs)
|
||||
local filter_reason = parent.filters:should_filter_as_reason(abs, stat, filter_status)
|
||||
if filter_reason == FILTER_REASON.none and not nodes_by_path[abs] then
|
||||
-- Type must come from fs_stat and not fs_scandir_next to maintain sshfs compatibility
|
||||
local t = stat and stat.type or nil
|
||||
local child = nil
|
||||
if t == "directory" and vim.loop.fs_access(abs, "R") then
|
||||
child = builders.folder(node, abs, name, stat)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user