expand "." to cwd on Windows

`LazyVim.root.detectors.pattern` returns `.` when the pattern matches in the current directory. If we do not expand the directory, Snacks will consider the current terminal window is for another directory. Instead of hiding the window, Snacks opens a new terminal window instead.
This commit is contained in:
ian 2026-03-19 18:44:25 +08:00 committed by GitHub
parent 6055e59613
commit 2f935df27b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -78,7 +78,11 @@ function M.realpath(path)
if path == "" or path == nil then if path == "" or path == nil then
return nil return nil
end end
path = vim.fn.has("win32") == 0 and vim.uv.fs_realpath(path) or path if vim.fn.has("win32") == 0 then
path = vim.uv.fs_realpath(path)
elseif path == "." then
path = vim.uv.cwd()
end
return LazyVim.norm(path) return LazyVim.norm(path)
end end