aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2024-10-23 23:32:32 +0800
committercrupest <crupest@outlook.com>2024-10-26 16:49:08 +0800
commit9f8bf5df8610d0270e440586ddd6293a0dafa340 (patch)
tree5183fbe2a8e5e01b6394b15af4bf2959ed940699
parentf66dfcc24f181cd702258a8847ff85544f5da589 (diff)
downloadcrupest-9f8bf5df8610d0270e440586ddd6293a0dafa340.tar.gz
crupest-9f8bf5df8610d0270e440586ddd6293a0dafa340.tar.bz2
crupest-9f8bf5df8610d0270e440586ddd6293a0dafa340.zip
fix(nvim): fix full_path on Windows.
-rw-r--r--configs/nvim/config-root/lua/crupest/utils/fs.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/configs/nvim/config-root/lua/crupest/utils/fs.lua b/configs/nvim/config-root/lua/crupest/utils/fs.lua
index d34c2f6..f1363ff 100644
--- a/configs/nvim/config-root/lua/crupest/utils/fs.lua
+++ b/configs/nvim/config-root/lua/crupest/utils/fs.lua
@@ -1,3 +1,5 @@
+local is_win = vim.fn.has("win32") ~= 0
+
local function clean_path(path)
if path == "/" then return path end
path = string.gsub(path, "[/\\]+", "/")
@@ -8,6 +10,7 @@ local function clean_path(path)
end
local function full_path(name)
+ if is_win and string.match(name, "^[a-zA-Z]:[/\\]?$") then return clean_path(name) end
local path = vim.fn.fnamemodify(name, ":p")
return clean_path(path)
end