diff options
| author | William Boman <william@redwill.se> | 2021-09-01 10:29:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-01 10:29:23 +0200 |
| commit | bfbf5fbd39fa75847bf23da2c46d12fe2728fb78 (patch) | |
| tree | f05d2f041f895ff639684c10f57d19f1d4a433e0 /lua/nvim-lsp-installer/path.lua | |
| parent | README: simplify example a bit, add clarifying comment (diff) | |
| download | mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar.gz mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar.bz2 mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar.lz mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar.xz mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.tar.zst mason-bfbf5fbd39fa75847bf23da2c46d12fe2728fb78.zip | |
add Windows support (#70)
Diffstat (limited to 'lua/nvim-lsp-installer/path.lua')
| -rw-r--r-- | lua/nvim-lsp-installer/path.lua | 5 |
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" } |
