aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2022-08-01 21:40:01 +0200
committerStephan Seitz <stephan.seitz@fau.de>2022-08-26 13:35:17 -0700
commit7ab2c037dd31afe4112a7ac22463bc8410f42219 (patch)
tree0eb526797a9009494d5e73d8f8cc129d3e628f29 /lua
parentUpdate lockfile.json (diff)
downloadnvim-treesitter-7ab2c037dd31afe4112a7ac22463bc8410f42219.tar
nvim-treesitter-7ab2c037dd31afe4112a7ac22463bc8410f42219.tar.gz
nvim-treesitter-7ab2c037dd31afe4112a7ac22463bc8410f42219.tar.bz2
nvim-treesitter-7ab2c037dd31afe4112a7ac22463bc8410f42219.tar.lz
nvim-treesitter-7ab2c037dd31afe4112a7ac22463bc8410f42219.tar.xz
nvim-treesitter-7ab2c037dd31afe4112a7ac22463bc8410f42219.tar.zst
nvim-treesitter-7ab2c037dd31afe4112a7ac22463bc8410f42219.zip
chore!: don't allow to silently use alternative install directory
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-treesitter/configs.lua31
1 files changed, 11 insertions, 20 deletions
diff --git a/lua/nvim-treesitter/configs.lua b/lua/nvim-treesitter/configs.lua
index e0618c861..ee34c9420 100644
--- a/lua/nvim-treesitter/configs.lua
+++ b/lua/nvim-treesitter/configs.lua
@@ -1,5 +1,4 @@
local api = vim.api
-local luv = vim.loop
local queries = require "nvim-treesitter.query"
local ts_query = require "vim.treesitter.query"
@@ -548,30 +547,22 @@ end
function M.get_parser_install_dir(folder_name)
folder_name = folder_name or "parser"
+ local install_dir
if config.parser_install_dir then
- local parser_dir = utils.join_path(config.parser_install_dir, folder_name)
- return utils.create_or_reuse_writable_dir(
- parser_dir,
- utils.join_space("Could not create parser dir '", parser_dir, "': "),
- utils.join_space("Parser dir '", parser_dir, "' should be read/write.")
- )
- end
-
- local package_path = utils.get_package_path()
- local package_path_parser_dir = utils.join_path(package_path, folder_name)
-
- -- If package_path is read/write, use that
- if luv.fs_access(package_path_parser_dir, "RW") then
- return package_path_parser_dir
+ install_dir = config.parser_install_dir
+ else
+ install_dir = utils.get_package_path()
end
-
- local site_dir = utils.get_site_dir()
- local parser_dir = utils.join_path(site_dir, folder_name)
+ local parser_dir = utils.join_path(install_dir, folder_name)
return utils.create_or_reuse_writable_dir(
parser_dir,
- nil,
- utils.join_space("Invalid rights,", package_path, "or", parser_dir, "should be read/write")
+ utils.join_space("Could not create parser dir '", parser_dir, "': "),
+ utils.join_space(
+ "Parser dir '",
+ parser_dir,
+ "' should be read/write (see README on how to configure an alternative install location)"
+ )
)
end