From dc1c93f459577d2c04cedda212d303129de2c804 Mon Sep 17 00:00:00 2001 From: erw7 Date: Sun, 1 Mar 2020 20:27:19 +0900 Subject: Fix problems when relative paths are passed --- lua/nvim_lsp/util.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lua/nvim_lsp/util.lua') diff --git a/lua/nvim_lsp/util.lua b/lua/nvim_lsp/util.lua index 433bcab2..82767905 100644 --- a/lua/nvim_lsp/util.lua +++ b/lua/nvim_lsp/util.lua @@ -128,6 +128,14 @@ M.path = (function() end end + local function is_absolute(filename) + if is_windows then + return filename:match("^%a:") or filename:match("^\\\\") + else + return filename:match("^/") + end + end + local dirname do local strip_dir_pat = path_sep.."([^"..path_sep.."]+)$" @@ -195,6 +203,7 @@ M.path = (function() return { is_dir = is_dir; is_file = is_file; + is_absolute = is_absolute; exists = exists; sep = path_sep; dirname = dirname; -- cgit v1.2.3-70-g09d2