Skip to content

Commit 07257b3

Browse files
committed
fix(files): fix empty path when dir=/, part of #186
1 parent 96d626e commit 07257b3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lua/neo-tree/command/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ M.execute = function(args)
9595
-- Handle setting directory if requested
9696
local path_changed = false
9797
if args.dir then
98-
if args.dir:sub(-1) == utils.path_separator then
98+
if #args.dir > 1 and args.dir:sub(-1) == utils.path_separator then
9999
args.dir = args.dir:sub(1, -2)
100100
end
101101
path_changed = state.path ~= args.dir

lua/neo-tree/sources/common/components.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ M.name = function(config, node, state)
238238
local text = node.name
239239
if node.type == "directory" then
240240
highlight = highlights.DIRECTORY_NAME
241-
if config.trailing_slash then
241+
if config.trailing_slash and text ~= "/" then
242242
text = text .. "/"
243243
end
244244
end

0 commit comments

Comments
 (0)