From 88a2a8557a92e69e683452e53a87b02b5d924412 Mon Sep 17 00:00:00 2001 From: William Boman Date: Sun, 15 Aug 2021 02:09:50 +0200 Subject: fs: assert unsafe operations are run on safe paths only --- lua/nvim-lsp-installer/path.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lua/nvim-lsp-installer/path.lua') diff --git a/lua/nvim-lsp-installer/path.lua b/lua/nvim-lsp-installer/path.lua index 97e3ed20..25498beb 100644 --- a/lua/nvim-lsp-installer/path.lua +++ b/lua/nvim-lsp-installer/path.lua @@ -35,4 +35,10 @@ function M.realpath(relpath, depth) return M.concat { vim.fn.fnamemodify(callsite_abs_path, ":h"), relpath } end +function M.is_subdirectory(root_path, path) + return path:find(root_path) == 1 +end + +M.SERVERS_ROOT_DIR = M.concat { vim.fn.stdpath "data", "lsp_servers" } + return M -- cgit v1.2.3-70-g09d2