aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/path.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/nvim-lsp-installer/path.lua')
-rw-r--r--lua/nvim-lsp-installer/path.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/lua/nvim-lsp-installer/path.lua b/lua/nvim-lsp-installer/path.lua
index 25498beb..4ed3d563 100644
--- a/lua/nvim-lsp-installer/path.lua
+++ b/lua/nvim-lsp-installer/path.lua
@@ -32,11 +32,12 @@ end
-- @return The realpath (absolute path). Note that this will currently produce results such as /Users/zuck/./script.js which may not be compatible with some tools.
function M.realpath(relpath, depth)
local callsite_abs_path = debug.getinfo(depth or 2, "S").source:sub(2)
- return M.concat { vim.fn.fnamemodify(callsite_abs_path, ":h"), relpath }
+ local normalized_relpath = relpath:gsub("./", "")
+ return M.concat { vim.fn.fnamemodify(callsite_abs_path, ":h"), normalized_relpath }
end
function M.is_subdirectory(root_path, path)
- return path:find(root_path) == 1
+ return path:sub(1, #root_path) == root_path
end
M.SERVERS_ROOT_DIR = M.concat { vim.fn.stdpath "data", "lsp_servers" }