From e4da418ba8388e94bb186e3f9a2004ee1e96f1e5 Mon Sep 17 00:00:00 2001 From: Mike <4576770+mike325@users.noreply.github.com> Date: Tue, 18 Jul 2023 08:36:04 +0200 Subject: fix(fs.lua): normalize slash truncation (#23753) Preserve last slash in windows' root drive directories --- runtime/lua/vim/fs.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/fs.lua b/runtime/lua/vim/fs.lua index 48d76e5d7e..d06dcb87cf 100644 --- a/runtime/lua/vim/fs.lua +++ b/runtime/lua/vim/fs.lua @@ -348,7 +348,11 @@ function M.normalize(path, opts) path = path:gsub('%$([%w_]+)', vim.uv.os_getenv) end - return (path:gsub('\\', '/'):gsub('/+', '/'):gsub('(.)/$', '%1')) + path = path:gsub('\\', '/'):gsub('/+', '/') + if iswin and path:match('^%w:/$') then + return path + end + return (path:gsub('(.)/$', '%1')) end return M -- cgit