From 47e6b2233feffc6e9d94f6086fb904eb5688fa25 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 23 Sep 2024 06:05:58 -0700 Subject: fix(vim.fs): dirname() returns "." on mingw/msys2 #30480 Problem: `vim.fs.dirname([[C:\User\XXX\AppData\Local]])` returns "." on mingw/msys2. Solution: - Check for "mingw" when deciding `iswin`. - Use `has("win32")` where possible, it works in "fast" contexts since b02eeb6a7281df0561a021d7ae595c84be9a01be. --- runtime/lua/vim/loader.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'runtime/lua/vim/loader.lua') diff --git a/runtime/lua/vim/loader.lua b/runtime/lua/vim/loader.lua index 2a881d1602..0211e8d4a1 100644 --- a/runtime/lua/vim/loader.lua +++ b/runtime/lua/vim/loader.lua @@ -208,8 +208,7 @@ end ---@return string|function ---@private function Loader.loader_lib(modname) - local sysname = uv.os_uname().sysname:lower() or '' - local is_win = sysname:find('win', 1, true) and not sysname:find('darwin', 1, true) + local is_win = vim.fn.has('win32') == 1 local ret = M.find(modname, { patterns = is_win and { '.dll' } or { '.so' } })[1] if ret then -- Making function name in Lua 5.1 (see src/loadlib.c:mkfuncname) is -- cgit