Using "vim.env.PATHEXT" to determine Windows executables. (#784)

This commit is contained in:
UnderCooled
2021-11-28 21:18:29 +08:00
committed by GitHub
parent 97f0039149
commit f2f1a34733
2 changed files with 23 additions and 3 deletions

View File

@@ -169,4 +169,17 @@ function M.merge_sort(t, comparator)
split_merge(t, 1, #t, comparator)
end
---Matching executable files in Windows.
---@param ext string
---@return boolean
local wexe = vim.split(vim.env.PATHEXT:gsub('%.', ''), ';')
local pathexts = {}
for _, v in pairs(wexe) do
pathexts[v] = true
end
function M.is_windows_exe(ext)
return pathexts[ext:upper()]
end
return M