aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/core/fs.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/nvim-lsp-installer/core/fs.lua')
-rw-r--r--lua/nvim-lsp-installer/core/fs.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/lua/nvim-lsp-installer/core/fs.lua b/lua/nvim-lsp-installer/core/fs.lua
index b915baf5..5106b40a 100644
--- a/lua/nvim-lsp-installer/core/fs.lua
+++ b/lua/nvim-lsp-installer/core/fs.lua
@@ -1,6 +1,8 @@
local uv = require "nvim-lsp-installer.core.async.uv"
local log = require "nvim-lsp-installer.log"
local a = require "nvim-lsp-installer.core.async"
+local Path = require "nvim-lsp-installer.path"
+local settings = require "nvim-lsp-installer.settings"
local M = {}
@@ -31,6 +33,12 @@ end
---@async
---@param path string
function M.rmrf(path)
+ assert(
+ Path.is_subdirectory(settings.current.install_root_dir, path),
+ (
+ "Refusing to rmrf %q which is outside of the allowed boundary %q. Please report this error at https://github.com/williamboman/nvim-lsp-installer/issues/new"
+ ):format(path, settings.current.install_root_dir)
+ )
log.debug("fs: rmrf", path)
if vim.in_fast_event() then
a.scheduler()
@@ -43,6 +51,13 @@ end
---@async
---@param path string
+function M.unlink(path)
+ log.debug("fs: unlink", path)
+ uv.fs_unlink(path)
+end
+
+---@async
+---@param path string
function M.mkdir(path)
log.debug("fs: mkdir", path)
uv.fs_mkdir(path, 493) -- 493(10) == 755(8)