diff options
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim-lsp-installer/fs.lua | 9 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/server.lua | 4 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lua/nvim-lsp-installer/fs.lua b/lua/nvim-lsp-installer/fs.lua index d9c4ac93..55809767 100644 --- a/lua/nvim-lsp-installer/fs.lua +++ b/lua/nvim-lsp-installer/fs.lua @@ -2,8 +2,8 @@ local uv = vim.loop local M = {} function M.mkdirp(path) - if os.execute(("mkdir -p %q"):format(path)) ~= 0 then - error(("mkdirp: Could not create directory %q"):format(path)) + if vim.fn.mkdir(path, "p") ~= 1 then + error(("mkdirp: Could not create directory %q."):format(path)) end end @@ -29,9 +29,8 @@ function M.fstat(path) end function M.rmrf(path) - -- giggity - if os.execute(("rm -rf %q"):format(path)) ~= 0 then - error(("rmrf: Could not remove directory %q"):format(path)) + if vim.fn.delete(path, "rf") ~= 0 then + error(("rmrf: Could not remove directory %q."):format(path)) end end diff --git a/lua/nvim-lsp-installer/server.lua b/lua/nvim-lsp-installer/server.lua index 95797e10..5e3c9e87 100644 --- a/lua/nvim-lsp-installer/server.lua +++ b/lua/nvim-lsp-installer/server.lua @@ -79,7 +79,9 @@ function M.Server:install() end function M.Server:uninstall() - fs.rmrf(self._root_dir) + if fs.dir_exists(self._root_dir) then + fs.rmrf(self._root_dir) + end end return M |
