mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-05 11:18:26 +00:00
fix(exporer.tree): and now hopefully on windows
This commit is contained in:
parent
6f5399b47c
commit
ef9b12d680
1 changed files with 2 additions and 1 deletions
|
@ -54,7 +54,7 @@ function Tree:find(path)
|
|||
end
|
||||
|
||||
local node = self.root
|
||||
local parts = vim.split(path:gsub("^/", ""), "/", { plain = true })
|
||||
local parts = vim.split(path, "/", { 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")
|
||||
|
@ -68,6 +68,7 @@ end
|
|||
function Tree:child(node, name, type)
|
||||
if not node.children[name] then
|
||||
local path = node.path .. "/" .. name
|
||||
path = node == self.root and name or path
|
||||
node.children[name] = {
|
||||
name = name,
|
||||
path = path,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue