Skip to content

Commit 77d9f48

Browse files
authored
fix(filesystem): normalize mixed path separators in Windows (#1258)
1 parent 9298c1b commit 77d9f48

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lua/neo-tree/utils/init.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,11 @@ M.normalize_path = function(path)
761761
if M.is_windows then
762762
-- normalize the drive letter to uppercase
763763
path = path:sub(1, 1):upper() .. path:sub(2)
764+
-- Turn mixed forward and back slashes into all forward slashes
765+
-- using NeoVim's logic
766+
path = vim.fs.normalize(path)
767+
-- Now use backslashes, as expected by the rest of Neo-Tree's code
768+
path = path:gsub("/", M.path_separator)
764769
end
765770
return path
766771
end

0 commit comments

Comments
 (0)