Skip to content

Commit 71122d7

Browse files
committed
fix: fs create on windows
1 parent 425f5ee commit 71122d7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lua/nvim-tree/fs.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ function M.create(node)
7777
local num_entries = get_num_entries(utils.path_split(utils.path_remove_trailing(ans)))
7878
for path in utils.path_split(ans) do
7979
idx = idx + 1
80-
path_to_create = utils.path_join({path_to_create, path})
80+
local p = utils.path_remove_trailing(path)
81+
if #path_to_create == 0 and vim.fn.has('win32') == 1 then
82+
path_to_create = utils.path_join({p, path_to_create})
83+
else
84+
path_to_create = utils.path_join({path_to_create, p})
85+
end
8186
if is_last_path_file and idx == num_entries then
8287
create_file(path_to_create)
8388
elseif not luv.fs_access(path_to_create, "r") then

0 commit comments

Comments
 (0)