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
  b02eeb6a72.
This commit is contained in:
Justin M. Keyes
2024-09-23 06:05:58 -07:00
committed by GitHub
parent 5acdc4499e
commit 47e6b2233f
5 changed files with 12 additions and 11 deletions

View File

@@ -2,7 +2,9 @@ local uv = vim.uv
local M = {}
local iswin = uv.os_uname().sysname == 'Windows_NT'
-- Can't use `has('win32')` because the `nvim -ll` test runner doesn't support `vim.fn` yet.
local sysname = uv.os_uname().sysname:lower()
local iswin = not not (sysname:find('windows') or sysname:find('mingw'))
local os_sep = iswin and '\\' or '/'
--- Iterate over all the parents of the given path.