mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-20 20:30:05 -04:00
feat(install): link queries with relative path
This commit is contained in:
parent
6fd7117c1d
commit
26dc6a5c90
1 changed files with 15 additions and 0 deletions
|
|
@ -320,6 +320,21 @@ end
|
||||||
---@return string? err
|
---@return string? err
|
||||||
local function do_link_queries(logger, query_src, query_dir)
|
local function do_link_queries(logger, query_src, query_dir)
|
||||||
uv_unlink(query_dir)
|
uv_unlink(query_dir)
|
||||||
|
|
||||||
|
local install_dir = fs.dirname(query_dir)
|
||||||
|
if not fs.relpath(query_src, install_dir) then
|
||||||
|
local prefix = "../"
|
||||||
|
for dir in fs.parents(install_dir) do
|
||||||
|
local relpath = fs.relpath(dir, query_src)
|
||||||
|
local is_root = dir:match("^/$") or dir:match("^%a:/$")
|
||||||
|
if relpath and not is_root then
|
||||||
|
query_src = prefix .. relpath
|
||||||
|
break
|
||||||
|
end
|
||||||
|
prefix = "../" .. prefix
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local err = uv_symlink(query_src, query_dir, { dir = true, junction = true })
|
local err = uv_symlink(query_src, query_dir, { dir = true, junction = true })
|
||||||
a.schedule()
|
a.schedule()
|
||||||
if err then
|
if err then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue