fix(health): normalize paths when checking runtimepath

This commit is contained in:
jayson wang 2026-04-01 11:43:31 +08:00
parent 7caec274fd
commit 57a2b8e3e1

View file

@ -20,6 +20,17 @@ local function check_exe(name)
end end
end end
---@param dir string
---@return boolean
local function check_runtimepath(dir)
for _, rtp in ipairs(vim.api.nvim_list_runtime_paths()) do
if vim.fs.normalize(rtp) == vim.fs.normalize(dir) then
return true
end
end
return false
end
local function install_health() local function install_health()
health.start('Requirements') health.start('Requirements')
@ -95,7 +106,7 @@ local function install_health()
else else
health.error('is not writable.') health.error('is not writable.')
end end
if vim.list_contains(vim.api.nvim_list_runtime_paths(), installdir) then if check_runtimepath(installdir) then
health.ok('is in runtimepath.') health.ok('is in runtimepath.')
else else
health.error('is not in runtimepath.') health.error('is not in runtimepath.')