mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
fix(explorer.tree): fix linux
This commit is contained in:
parent
c255d9c6a0
commit
6f5399b47c
1 changed files with 2 additions and 2 deletions
|
@ -54,7 +54,7 @@ function Tree:find(path)
|
|||
end
|
||||
|
||||
local node = self.root
|
||||
local parts = vim.split(path, "/", { plain = true })
|
||||
local parts = vim.split(path:gsub("^/", ""), "/", { plain = true })
|
||||
local is_dir = vim.fn.isdirectory(path) == 1
|
||||
for p, part in ipairs(parts) do
|
||||
node = self:child(node, part, (is_dir or p < #parts) and "directory" or "file")
|
||||
|
@ -67,7 +67,7 @@ end
|
|||
---@param type string
|
||||
function Tree:child(node, name, type)
|
||||
if not node.children[name] then
|
||||
local path = ((node.path == "" and "" or (node.path .. "/")) .. name)
|
||||
local path = node.path .. "/" .. name
|
||||
node.children[name] = {
|
||||
name = name,
|
||||
path = path,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue