aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/core/installer/context.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-05-11 16:10:57 +0200
committerGitHub <noreply@github.com>2022-05-11 16:10:57 +0200
commit5e3385d90668c792919c7e2791620a6c0d569538 (patch)
tree4b0158d3ac7765db47411d57ec754a96f8eaf1f9 /lua/nvim-lsp-installer/core/installer/context.lua
parentchore!: remove zeta_note (diff)
downloadmason-5e3385d90668c792919c7e2791620a6c0d569538.tar
mason-5e3385d90668c792919c7e2791620a6c0d569538.tar.gz
mason-5e3385d90668c792919c7e2791620a6c0d569538.tar.bz2
mason-5e3385d90668c792919c7e2791620a6c0d569538.tar.lz
mason-5e3385d90668c792919c7e2791620a6c0d569538.tar.xz
mason-5e3385d90668c792919c7e2791620a6c0d569538.tar.zst
mason-5e3385d90668c792919c7e2791620a6c0d569538.zip
chore: further decouple module structure (#685)
Diffstat (limited to 'lua/nvim-lsp-installer/core/installer/context.lua')
-rw-r--r--lua/nvim-lsp-installer/core/installer/context.lua28
1 files changed, 14 insertions, 14 deletions
diff --git a/lua/nvim-lsp-installer/core/installer/context.lua b/lua/nvim-lsp-installer/core/installer/context.lua
index 366a3b77..aaec4ff5 100644
--- a/lua/nvim-lsp-installer/core/installer/context.lua
+++ b/lua/nvim-lsp-installer/core/installer/context.lua
@@ -1,8 +1,8 @@
local spawn = require "nvim-lsp-installer.core.spawn"
local log = require "nvim-lsp-installer.log"
local fs = require "nvim-lsp-installer.core.fs"
-local path = require "nvim-lsp-installer.path"
-local platform = require "nvim-lsp-installer.platform"
+local path = require "nvim-lsp-installer.core.path"
+local platform = require "nvim-lsp-installer.core.platform"
local receipt = require "nvim-lsp-installer.core.receipt"
local installer = require "nvim-lsp-installer.core.installer"
local a = require "nvim-lsp-installer.core.async"
@@ -41,51 +41,51 @@ end
---@param rel_path string @The relative path from the current working directory to the file to append.
---@param contents string
function ContextualFs:append_file(rel_path, contents)
- return fs.append_file(path.concat { self.cwd:get(), rel_path }, contents)
+ return fs.async.append_file(path.concat { self.cwd:get(), rel_path }, contents)
end
---@async
---@param rel_path string @The relative path from the current working directory to the file to write.
---@param contents string
function ContextualFs:write_file(rel_path, contents)
- return fs.write_file(path.concat { self.cwd:get(), rel_path }, contents)
+ return fs.async.write_file(path.concat { self.cwd:get(), rel_path }, contents)
end
---@async
---@param rel_path string @The relative path from the current working directory.
function ContextualFs:file_exists(rel_path)
- return fs.file_exists(path.concat { self.cwd:get(), rel_path })
+ return fs.async.file_exists(path.concat { self.cwd:get(), rel_path })
end
---@async
---@param rel_path string @The relative path from the current working directory.
function ContextualFs:dir_exists(rel_path)
- return fs.dir_exists(path.concat { self.cwd:get(), rel_path })
+ return fs.async.dir_exists(path.concat { self.cwd:get(), rel_path })
end
---@async
---@param rel_path string @The relative path from the current working directory.
function ContextualFs:rmrf(rel_path)
- return fs.rmrf(path.concat { self.cwd:get(), rel_path })
+ return fs.async.rmrf(path.concat { self.cwd:get(), rel_path })
end
---@async
---@param rel_path string @The relative path from the current working directory.
function ContextualFs:unlink(rel_path)
- return fs.unlink(path.concat { self.cwd:get(), rel_path })
+ return fs.async.unlink(path.concat { self.cwd:get(), rel_path })
end
---@async
---@param old_path string
---@param new_path string
function ContextualFs:rename(old_path, new_path)
- return fs.rename(path.concat { self.cwd:get(), old_path }, path.concat { self.cwd:get(), new_path })
+ return fs.async.rename(path.concat { self.cwd:get(), old_path }, path.concat { self.cwd:get(), new_path })
end
---@async
---@param dirpath string
function ContextualFs:mkdir(dirpath)
- return fs.mkdir(path.concat { self.cwd:get(), dirpath })
+ return fs.async.mkdir(path.concat { self.cwd:get(), dirpath })
end
---@class CwdManager
@@ -154,16 +154,16 @@ function InstallContext:promote_cwd()
end
log.fmt_debug("Promoting cwd %s to %s", cwd, self.destination_dir)
-- 1. Remove destination dir, if it exists
- if fs.dir_exists(self.destination_dir) then
- fs.rmrf(self.destination_dir)
+ if fs.async.dir_exists(self.destination_dir) then
+ fs.async.rmrf(self.destination_dir)
end
-- 2. Prepare for renaming cwd to destination
if platform.is_unix then
-- Some Unix systems will raise an error when renaming a directory to a destination that does not already exist.
- fs.mkdir(self.destination_dir)
+ fs.async.mkdir(self.destination_dir)
end
-- 3. Move the cwd to the final installation directory
- fs.rename(cwd, self.destination_dir)
+ fs.async.rename(cwd, self.destination_dir)
-- 4. Update cwd
self.cwd:set(self.destination_dir)
end