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/fs.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/fs.lua') diff --git a/runtime/lua/vim/fs.lua b/runtime/lua/vim/fs.lua index d145c5d531..0d2e2f907f 100644 --- a/runtime/lua/vim/fs.lua +++ b/runtime/lua/vim/fs.lua @@ -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. -- cgit