diff options
| author | Stephan Seitz <stephan.seitz@fau.de> | 2022-08-01 21:40:01 +0200 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-08-26 13:35:17 -0700 |
| commit | 7ab2c037dd31afe4112a7ac22463bc8410f42219 (patch) | |
| tree | 0eb526797a9009494d5e73d8f8cc129d3e628f29 /lua | |
| parent | Update lockfile.json (diff) | |
| download | nvim-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.lua | 31 |
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 |
