diff options
| author | William Boman <william@redwill.se> | 2021-08-15 01:54:41 +0200 |
|---|---|---|
| committer | William Boman <william@redwill.se> | 2021-08-15 02:00:47 +0200 |
| commit | e4a2926712e1f682f869bf9e89e2de54d0c5d47f (patch) | |
| tree | 5b6e0cd04a5aaf8c35b1f4f0e51f36b493ec63be /lua | |
| parent | stylua (diff) | |
| download | mason-e4a2926712e1f682f869bf9e89e2de54d0c5d47f.tar mason-e4a2926712e1f682f869bf9e89e2de54d0c5d47f.tar.gz mason-e4a2926712e1f682f869bf9e89e2de54d0c5d47f.tar.bz2 mason-e4a2926712e1f682f869bf9e89e2de54d0c5d47f.tar.lz mason-e4a2926712e1f682f869bf9e89e2de54d0c5d47f.tar.xz mason-e4a2926712e1f682f869bf9e89e2de54d0c5d47f.tar.zst mason-e4a2926712e1f682f869bf9e89e2de54d0c5d47f.zip | |
fs: use native vim.fns
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 |
