parent
81eb718394
commit
c5fba1ec18
@ -11,6 +11,7 @@ function M.folder(parent, absolute_path, name)
|
||||
local has_children = handle and uv.fs_scandir_next(handle) ~= nil
|
||||
|
||||
return {
|
||||
type = "directory",
|
||||
absolute_path = absolute_path,
|
||||
fs_stat = uv.fs_stat(absolute_path),
|
||||
group_next = nil, -- If node is grouped, this points to the next child dir/link node
|
||||
@ -34,6 +35,7 @@ function M.file(parent, absolute_path, name)
|
||||
local ext = string.match(name, ".?[^.]+%.(.*)") or ""
|
||||
|
||||
return {
|
||||
type = "file",
|
||||
absolute_path = absolute_path,
|
||||
executable = M.is_executable(absolute_path, ext),
|
||||
extension = ext,
|
||||
@ -61,6 +63,7 @@ function M.link(parent, absolute_path, name)
|
||||
end
|
||||
|
||||
return {
|
||||
type = "link",
|
||||
absolute_path = absolute_path,
|
||||
fs_stat = uv.fs_stat(absolute_path),
|
||||
group_next = nil, -- If node is grouped, this points to the next child dir/link node
|
||||
|
||||
@ -45,6 +45,18 @@ function M.reload(node, status)
|
||||
t = t or (uv.fs_stat(abs) or {}).type
|
||||
if not filters.should_ignore(abs) and not filters.should_ignore_git(abs, status.files) then
|
||||
child_names[abs] = true
|
||||
|
||||
-- Recreate node if type changes.
|
||||
if nodes_by_path[abs] then
|
||||
local n = nodes_by_path[abs]
|
||||
|
||||
if n.type ~= t then
|
||||
utils.array_remove(node.nodes, n)
|
||||
common.node_destroy(n)
|
||||
nodes_by_path[abs] = nil
|
||||
end
|
||||
end
|
||||
|
||||
if not nodes_by_path[abs] then
|
||||
if t == "directory" and uv.fs_access(abs, "R") then
|
||||
local folder = builders.folder(node, abs, name)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user